diff options
author | Muxi Yan <muxi@users.noreply.github.com> | 2018-12-10 10:15:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 10:15:45 -0800 |
commit | 037173217011b38ff4675d028eba27a068db5975 (patch) | |
tree | 7bf135f4481365dad05cb4ce181cc8259647a3da /include/grpcpp/server.h | |
parent | 3f00d61b04874cc5f0159c16f2c598a8f2fb93a7 (diff) | |
parent | 60f2d379fec3364ff59f4f0d463b16275525863d (diff) |
Merge branch 'master' into config-isolation
Diffstat (limited to 'include/grpcpp/server.h')
-rw-r--r-- | include/grpcpp/server.h | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/include/grpcpp/server.h b/include/grpcpp/server.h index 8d3e856502..cdcac186cb 100644 --- a/include/grpcpp/server.h +++ b/include/grpcpp/server.h @@ -111,8 +111,8 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { /// interceptors std::shared_ptr<Channel> InProcessChannelWithInterceptors( const ChannelArguments& args, - std::unique_ptr<std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>> + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> interceptor_creators); private: @@ -174,7 +174,11 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>> sync_server_cqs, int min_pollers, int max_pollers, int sync_cq_timeout_msec, - grpc_resource_quota* server_rq = nullptr); + grpc_resource_quota* server_rq = nullptr, + std::vector< + std::unique_ptr<experimental::ServerInterceptorFactoryInterface>> + interceptor_creators = std::vector<std::unique_ptr< + experimental::ServerInterceptorFactoryInterface>>()); /// Start the server. /// @@ -187,11 +191,17 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { grpc_server* server() override { return server_; }; private: + std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>* + interceptor_creators() override { + return &interceptor_creators_; + } + friend class AsyncGenericService; friend class ServerBuilder; friend class ServerInitializer; class SyncRequest; + class CallbackRequest; class UnimplementedAsyncRequest; class UnimplementedAsyncResponse; @@ -214,8 +224,18 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { return max_receive_message_size_; }; + CompletionQueue* CallbackCQ() override; + ServerInitializer* initializer(); + // A vector of interceptor factory objects. + // This should be destroyed after health_check_service_ and this requirement + // is satisfied by declaring interceptor_creators_ before + // health_check_service_. (C++ mandates that member objects be destroyed in + // the reverse order of initialization.) + std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>> + interceptor_creators_; + const int max_receive_message_size_; /// The following completion queues are ONLY used in case of Sync API @@ -228,6 +248,9 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { /// the \a sync_server_cqs) std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_; + /// Outstanding callback requests + std::vector<std::unique_ptr<CallbackRequest>> callback_reqs_; + // Server status std::mutex mu_; bool started_; @@ -251,6 +274,13 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { // A special handler for resource exhausted in sync case std::unique_ptr<internal::MethodHandler> resource_exhausted_handler_; + + // callback_cq_ references the callbackable completion queue associated + // with this server (if any). It is set on the first call to CallbackCQ(). + // It is _not owned_ by the server; ownership belongs with its internal + // shutdown callback tag (invoked when the CQ is fully shutdown). + // It is protected by mu_ + CompletionQueue* callback_cq_ = nullptr; }; } // namespace grpc |