diff options
author | David Garcia Quintas <dgq@google.com> | 2015-07-15 14:15:58 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-07-15 14:15:58 -0700 |
commit | 211e65be3cb1f4b6f7184c1945d8284905f79968 (patch) | |
tree | e6c7ee9e1612a6b12fa99446a72dda5d5d64769f /src/cpp/server/server.cc | |
parent | ffe3d2b1908933a149932502fd0607239ccef88a (diff) | |
parent | 3e5d61670e23b040ed47b2df1e4c87ee2cfec4aa (diff) |
Merge branch 'master' of github.com:grpc/grpc into str_join_with_sep
Diffstat (limited to 'src/cpp/server/server.cc')
-rw-r--r-- | src/cpp/server/server.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 1437b2dea7..e6761d6244 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -118,7 +118,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { has_request_payload_(mrd->has_request_payload_), request_payload_(mrd->request_payload_), method_(mrd->method_) { - ctx_.call_ = mrd->call_; + ctx_.set_call(mrd->call_); ctx_.cq_ = &cq_; GPR_ASSERT(mrd->in_flight_); mrd->in_flight_ = false; @@ -207,10 +207,11 @@ Server::~Server() { delete sync_methods_; } -bool Server::RegisterService(RpcService* service) { +bool Server::RegisterService(const grpc::string *host, RpcService* service) { for (int i = 0; i < service->GetMethodCount(); ++i) { RpcServiceMethod* method = service->GetMethod(i); - void* tag = grpc_server_register_method(server_, method->name(), nullptr); + void* tag = grpc_server_register_method( + server_, method->name(), host ? host->c_str() : nullptr); if (!tag) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); @@ -222,14 +223,14 @@ bool Server::RegisterService(RpcService* service) { return true; } -bool Server::RegisterAsyncService(AsynchronousService* service) { +bool Server::RegisterAsyncService(const grpc::string *host, AsynchronousService* service) { GPR_ASSERT(service->server_ == nullptr && "Can only register an asynchronous service against one server."); service->server_ = this; service->request_args_ = new void*[service->method_count_]; for (size_t i = 0; i < service->method_count_; ++i) { void* tag = grpc_server_register_method(server_, service->method_names_[i], - nullptr); + host ? host->c_str() : nullptr); if (!tag) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", service->method_names_[i]); @@ -325,7 +326,7 @@ bool Server::BaseAsyncRequest::FinalizeResult(void** tag, bool* status) { } } grpc_metadata_array_destroy(&initial_metadata_array_); - context_->call_ = call_; + context_->set_call(call_); context_->cq_ = call_cq_; Call call(call_, server_, call_cq_, server_->max_message_size_); if (*status && call_) { |