Skip to content

Commit

Permalink
Merge pull request #1451 from serverglen/error_var_name
Browse files Browse the repository at this point in the history
Fix baidu_rpc_protocol.cpp a variable incorrectly named
  • Loading branch information
lorinlee authored Jul 5, 2021
2 parents 8dc52a7 + fafd897 commit a08ade1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/brpc/policy/baidu_rpc_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a08ade1

Please sign in to comment.