diff options
author | Yang Gao <yangg@google.com> | 2015-02-12 22:51:38 -0800 |
---|---|---|
committer | Yang Gao <yangg@google.com> | 2015-02-12 22:51:38 -0800 |
commit | 0c7aafaa0caf7b9fb3dfabb35f4270033b4ad164 (patch) | |
tree | e2f271e7b0002ff6e6bfffc94342501e670927b5 /include/grpc++ | |
parent | c17e861aa06cfe2a75159192cdb90b425801aa5f (diff) |
change AddRecvMessage signature
Diffstat (limited to 'include/grpc++')
-rw-r--r-- | include/grpc++/impl/call.h | 4 | ||||
-rw-r--r-- | include/grpc++/stream.h | 31 |
2 files changed, 15 insertions, 20 deletions
diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 7aa22ee7c2..af1c710098 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -68,7 +68,7 @@ class CallOpBuffer : public CompletionQueueTag { void AddRecvInitialMetadata( std::multimap<grpc::string, grpc::string> *metadata); void AddSendMessage(const google::protobuf::Message &message); - void AddRecvMessage(google::protobuf::Message *message, bool* got_message); + void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(std::multimap<grpc::string, grpc::string> *metadata, Status *status); @@ -84,6 +84,7 @@ class CallOpBuffer : public CompletionQueueTag { // Called by completion queue just prior to returning from Next() or Pluck() void FinalizeResult(void **tag, bool *status) override; + bool got_message = false; private: void *return_tag_ = nullptr; // Send initial metadata @@ -98,7 +99,6 @@ class CallOpBuffer : public CompletionQueueTag { grpc_byte_buffer* send_message_buf_ = nullptr; // Recv message google::protobuf::Message* recv_message_ = nullptr; - bool* got_message_ = nullptr; grpc_byte_buffer* recv_message_buf_ = nullptr; // Client send close bool client_send_close_ = false; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6f2441ff92..ecc28f6216 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -119,10 +119,9 @@ class ClientReader final : public ClientStreamingInterface, buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_.PerformOps(&buf); - return cq_.Pluck(&buf) && got_message; + return cq_.Pluck(&buf) && buf.got_message; } virtual Status Finish() override { @@ -174,11 +173,10 @@ class ClientWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - bool got_message; - buf.AddRecvMessage(response_, &got_message); + buf.AddRecvMessage(response_); buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); call_.PerformOps(&buf); - GPR_ASSERT(cq_.Pluck(&buf) && got_message); + GPR_ASSERT(cq_.Pluck(&buf) && buf.got_message); return status; } @@ -225,10 +223,9 @@ class ClientReaderWriter final : public ClientStreamingInterface, buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_.PerformOps(&buf); - return cq_.Pluck(&buf) && got_message; + return cq_.Pluck(&buf) && buf.got_message; } virtual bool Write(const W& msg) override { @@ -277,10 +274,9 @@ class ServerReader final : public ReaderInterface<R> { virtual bool Read(R* msg) override { CallOpBuffer buf; - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf) && got_message; + return call_->cq()->Pluck(&buf) && buf.got_message; } private: @@ -338,10 +334,9 @@ class ServerReaderWriter final : public WriterInterface<W>, virtual bool Read(R* msg) override { CallOpBuffer buf; - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf) && got_message; + return call_->cq()->Pluck(&buf) && buf.got_message; } virtual bool Write(const W& msg) override { @@ -420,7 +415,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - read_buf_.AddRecvMessage(msg, nullptr); + read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } @@ -484,7 +479,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - finish_buf_.AddRecvMessage(response_, nullptr); + finish_buf_.AddRecvMessage(response_); finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -529,7 +524,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - read_buf_.AddRecvMessage(msg, nullptr); + read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } |