Skip to content

Commit

Permalink
Merge pull request #1762 from wwbmmm/check_append
Browse files Browse the repository at this point in the history
Make process exit when IOBuf::append failed in SerializeRpcHeaderAndMeta
  • Loading branch information
zyearn committed Jun 20, 2022
2 parents 392412d + 702abe2 commit a4c4e1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/brpc/policy/baidu_rpc_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ static void SerializeRpcHeaderAndMeta(
::google::protobuf::io::CodedOutputStream coded_out(&arr_out);
meta.SerializeWithCachedSizes(&coded_out); // not calling ByteSize again
CHECK(!coded_out.HadError());
out->append(header_and_meta, sizeof(header_and_meta));
CHECK_EQ(0, out->append(header_and_meta, sizeof(header_and_meta)));
} else {
char header[12];
PackRpcHeader(header, meta_size, payload_size);
out->append(header, sizeof(header));
CHECK_EQ(0, out->append(header, sizeof(header)));
butil::IOBufAsZeroCopyOutputStream buf_stream(out);
::google::protobuf::io::CodedOutputStream coded_out(&buf_stream);
meta.SerializeWithCachedSizes(&coded_out);
Expand Down

0 comments on commit a4c4e1a

Please sign in to comment.