You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/05/13 08:01:01 UTC

[GitHub] [incubator-brpc] amosbird commented on a diff in pull request #1762: Check append return code

amosbird commented on code in PR #1762:
URL: https://github.com/apache/incubator-brpc/pull/1762#discussion_r872108717


##########
src/brpc/policy/baidu_rpc_protocol.cpp:
##########
@@ -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)));

Review Comment:
   IIUC this is just a assertion and will only be effective in debug build. Perhaps we should change the return type of `SerializeRpcHeaderAndMeta` into `bool` and handle it properly, similar to what we did for `SerializeAsCompressedData`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org