aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2017-02-08 10:03:42 -0800
committerGravatar GitHub <noreply@github.com>2017-02-08 10:03:42 -0800
commitf0ef22496c1e10d954f062bfa40b540eee1cac69 (patch)
tree17376c6182ce2fe69c9fc11c3b52cfe7220b9afe
parent9d704d209af824986bad2069c5ad2d7f37aaac9a (diff)
parentf2fe4f7dbd00a285f265167bb8fec5c48fd7345b (diff)
Merge pull request #9629 from yang-g/qqq
Add a PreServerStart in global server callbacks
-rw-r--r--include/grpc++/server.h2
-rw-r--r--src/cpp/server/server_cc.cc1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index fba9952e6e..002f252a8f 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -88,6 +88,8 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen {
virtual void PreSynchronousRequest(ServerContext* context) = 0;
/// Called after application callback for each synchronous server request
virtual void PostSynchronousRequest(ServerContext* context) = 0;
+ /// Called before server is started.
+ virtual void PreServerStart(Server* server) {}
};
/// Set the global callback object. Can only be called once. Does not take
/// ownership of callbacks, and expects the pointed to object to be alive
diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc
index f6a7f1d755..29898a4209 100644
--- a/src/cpp/server/server_cc.cc
+++ b/src/cpp/server/server_cc.cc
@@ -478,6 +478,7 @@ int Server::AddListeningPort(const grpc::string& addr,
bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) {
GPR_ASSERT(!started_);
+ global_callbacks_->PreServerStart(this);
started_ = true;
grpc_server_start(server_);