diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-02-12 09:49:24 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-02-12 09:49:24 -0800 |
commit | 2e70dc18c6776ca50fcc28e7766445f0c34a81c4 (patch) | |
tree | 32362bac0c3165c76459855a141e95eeb56c2b5e /src/cpp | |
parent | 20bc56d8908358b1e4f8e8d853a3d3c53f8cb4fe (diff) | |
parent | ea222b2001bddc573f9151847cdd339ff517e54c (diff) |
Merge pull request #10 from yang-g/c++api
Put in SendInitialMetadata and WaitForInitialMetadata in some places.
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/common/call.cc | 6 | ||||
-rw-r--r-- | src/cpp/server/server.cc | 1 | ||||
-rw-r--r-- | src/cpp/server/server_context.cc | 7 |
3 files changed, 6 insertions, 8 deletions
diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index a20d4a0d9a..aae69084eb 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -121,6 +121,12 @@ void CallOpBuffer::AddSendInitialMetadata( initial_metadata_ = FillMetadataArray(metadata); } +void CallOpBuffer::AddRecvInitialMetadata( + std::multimap<grpc::string, grpc::string>* metadata) { + recv_initial_metadata_ = metadata; +} + + void CallOpBuffer::AddSendInitialMetadata(ClientContext *ctx) { AddSendInitialMetadata(&ctx->send_initial_metadata_); } diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 938a549d4f..ea5d365154 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -177,7 +177,6 @@ class Server::MethodRequestData final : public CompletionQueueTag { auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); CallOpBuffer buf; - ctx_.SendInitialMetadataIfNeeded(&buf); if (has_response_payload_) { buf.AddSendMessage(*res); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 06eeb39297..1823dfc81b 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -49,11 +49,4 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, } } -void ServerContext::SendInitialMetadataIfNeeded(CallOpBuffer* buf) { - if (!sent_initial_metadata_) { - buf->AddSendInitialMetadata(&initial_metadata_); - sent_initial_metadata_ = true; - } -} - } // namespace grpc |