aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/common
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-11 21:08:49 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-11 21:08:49 -0800
commit0156752a66e5e8f00e7e49fd1aae35a6b8157cca (patch)
treeb9ba6857ea36976c8c47407ef79dec03a76a679e /src/cpp/common
parent504bd331aba5817c2753c4f447f40cc83fa4d907 (diff)
Some streaming progress
Diffstat (limited to 'src/cpp/common')
-rw-r--r--src/cpp/common/call.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc
index d90ef0311e..a20d4a0d9a 100644
--- a/src/cpp/common/call.cc
+++ b/src/cpp/common/call.cc
@@ -58,6 +58,7 @@ void CallOpBuffer::Reset(void* next_return_tag) {
}
recv_message_ = nullptr;
+ got_message_ = nullptr;
if (recv_message_buf_) {
grpc_byte_buffer_destroy(recv_message_buf_);
recv_message_buf_ = nullptr;
@@ -128,8 +129,9 @@ void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) {
send_message_ = &message;
}
-void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) {
+void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message, bool* got_message) {
recv_message_ = message;
+ got_message_ = got_message;
}
void CallOpBuffer::AddClientSendClose() {
@@ -239,10 +241,15 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) {
FillMetadataMap(&recv_initial_metadata_arr_, recv_initial_metadata_);
}
// Parse received message if any.
- if (recv_message_ && recv_message_buf_) {
- *status = DeserializeProto(recv_message_buf_, recv_message_);
- grpc_byte_buffer_destroy(recv_message_buf_);
- recv_message_buf_ = nullptr;
+ if (recv_message_) {
+ if (recv_message_buf_) {
+ *got_message_ = true;
+ *status = DeserializeProto(recv_message_buf_, recv_message_);
+ grpc_byte_buffer_destroy(recv_message_buf_);
+ recv_message_buf_ = nullptr;
+ } else {
+ *got_message_ = false;
+ }
}
// Parse received status.
if (recv_status_) {