diff options
author | Craig Tiller <ctiller@google.com> | 2015-05-27 09:55:51 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-05-27 09:55:51 -0700 |
commit | bce999f57f987605944ca8ddad671775a634be6a (patch) | |
tree | 564cbf120c1e39e1ea9731142d4cdd9d58fde743 /src/cpp | |
parent | afa2d6342fc7c608141f058a7d4bb0778ae24f53 (diff) |
Refine shutdown API
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/server/server.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index e66b4ed2d8..bcd631963f 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -52,6 +52,14 @@ namespace grpc { +class Server::ShutdownRequest GRPC_FINAL : public CompletionQueueTag { + public: + bool FinalizeResult(void** tag, bool* status) { + delete this; + return false; + } +}; + class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { public: SyncRequest(RpcServiceMethod* method, void* tag) @@ -286,7 +294,7 @@ void Server::Shutdown() { grpc::unique_lock<grpc::mutex> lock(mu_); if (started_ && !shutdown_) { shutdown_ = true; - grpc_server_shutdown(server_); + grpc_server_shutdown_and_notify(server_, cq_.cq(), new ShutdownRequest()); cq_.Shutdown(); // Wait for running callbacks to finish. |