diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index df800d940dd..f1142cf8e56 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -31,6 +31,7 @@ * */ +#include #include #include #include @@ -144,6 +145,7 @@ void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { void CallOpBuffer::AddRecvMessage(google::protobuf::Message* message) { recv_message_ = message; + recv_message_->Clear(); } void CallOpBuffer::AddClientSendClose() { client_send_close_ = true; } @@ -253,8 +255,8 @@ void CallOpBuffer::FinalizeResult(void** tag, bool* status) { // Parse received message if any. if (recv_message_) { if (recv_message_buf_) { - got_message = true; - *status = DeserializeProto(recv_message_buf_, recv_message_); + got_message = *status; + *status = *status && DeserializeProto(recv_message_buf_, recv_message_); grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; } else { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 294eeae5850..ee9a1daa8e9 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -314,7 +314,7 @@ class Server::AsyncRequest final : public CompletionQueueTag { *tag = tag_; if (*status && request_) { if (payload_) { - *status = DeserializeProto(payload_, request_); + *status = *status && DeserializeProto(payload_, request_); } else { *status = false; }