Skip to content
Permalink
Browse files
Merge pull request #1451 from serverglen/error_var_name
Fix baidu_rpc_protocol.cpp a variable incorrectly named
  • Loading branch information
lorinlee committed Jul 5, 2021
2 parents 8dc52a7 + fafd897 commit a08ade1d037f66965af24c6b1c3d1ae9ea8df5a4
Showing 1 changed file with 8 additions and 8 deletions.
@@ -452,18 +452,18 @@ void ProcessRpcRequest(InputMessageBase* msg_base) {
if (span) {
span->ResetServerSpanName(method->full_name());
}
const int reqsize = static_cast<int>(msg->payload.size());
const int req_size = static_cast<int>(msg->payload.size());
butil::IOBuf req_buf;
butil::IOBuf* req_buf_ptr = &msg->payload;
if (meta.has_attachment_size()) {
if (reqsize < meta.attachment_size()) {
if (req_size < meta.attachment_size()) {
cntl->SetFailed(EREQUEST,
"attachment_size=%d is larger than request_size=%d",
meta.attachment_size(), reqsize);
meta.attachment_size(), req_size);
break;
}
int att_size = reqsize - meta.attachment_size();
msg->payload.cutn(&req_buf, att_size);
int body_without_attachment_size = req_size - meta.attachment_size();
msg->payload.cutn(&req_buf, body_without_attachment_size);
req_buf_ptr = &req_buf;
cntl->request_attachment().swap(msg->payload);
}
@@ -473,7 +473,7 @@ void ProcessRpcRequest(InputMessageBase* msg_base) {
if (!ParseFromCompressedData(*req_buf_ptr, req.get(), req_cmp_type)) {
cntl->SetFailed(EREQUEST, "Fail to parse request message, "
"CompressType=%s, request_size=%d",
CompressTypeToCStr(req_cmp_type), reqsize);
CompressTypeToCStr(req_cmp_type), req_size);
break;
}

@@ -595,8 +595,8 @@ void ProcessRpcResponse(InputMessageBase* msg_base) {
meta.attachment_size(), res_size);
break;
}
int att_size = res_size - meta.attachment_size();
msg->payload.cutn(&res_buf, att_size);
int body_without_attachment_size = res_size - meta.attachment_size();
msg->payload.cutn(&res_buf, body_without_attachment_size);
res_buf_ptr = &res_buf;
cntl->response_attachment().swap(msg->payload);
}

0 comments on commit a08ade1

Please sign in to comment.