Properly implement unimplemented RPCs at callback-only server

pull/18289/head
Vijay Pai 6 years ago
parent 240bf86760
commit b7f14fdab8
  1. 4
      include/grpcpp/server.h
  2. 8
      src/cpp/server/server_cc.cc

@ -326,6 +326,10 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
std::unique_ptr<HealthCheckServiceInterface> health_check_service_;
bool health_check_service_disabled_;
// When appropriate, use a default callback generic service to handle
// unimplemented methods
std::unique_ptr<experimental::CallbackGenericService> unimplemented_service_;
// A special handler for resource exhausted in sync case
std::unique_ptr<internal::MethodHandler> resource_exhausted_handler_;

@ -1004,6 +1004,14 @@ void Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) {
RegisterService(nullptr, default_health_check_service_impl);
}
// If this server uses callback methods, then create a callback generic
// service to handle any unimplemented methods using the default reactor
// creator
if (!callback_reqs_to_start_.empty() && !has_callback_generic_service_) {
unimplemented_service_.reset(new experimental::CallbackGenericService);
RegisterCallbackGenericService(unimplemented_service_.get());
}
grpc_server_start(server_);
if (!has_async_generic_service_ && !has_callback_generic_service_) {

Loading…
Cancel
Save