Add a PreServerStart in global server callbacks
This commit is contained in:
parent
27ee9d015d
commit
f2fe4f7dbd
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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_);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue