aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc++')
-rw-r--r--include/grpc++/impl/codegen/grpc_library.h26
-rw-r--r--include/grpc++/impl/codegen/server_context.h1
-rw-r--r--include/grpc++/server.h2
3 files changed, 19 insertions, 10 deletions
diff --git a/include/grpc++/impl/codegen/grpc_library.h b/include/grpc++/impl/codegen/grpc_library.h
index 2b11aff214..3735d04e8c 100644
--- a/include/grpc++/impl/codegen/grpc_library.h
+++ b/include/grpc++/impl/codegen/grpc_library.h
@@ -51,18 +51,26 @@ extern GrpcLibraryInterface* g_glip;
/// Classes that require gRPC to be initialized should inherit from this class.
class GrpcLibraryCodegen {
public:
- GrpcLibraryCodegen() {
- GPR_CODEGEN_ASSERT(g_glip &&
- "gRPC library not initialized. See "
- "grpc::internal::GrpcLibraryInitializer.");
- g_glip->init();
+ GrpcLibraryCodegen(bool call_grpc_init = true) : grpc_init_called_(false) {
+ if (call_grpc_init) {
+ GPR_CODEGEN_ASSERT(g_glip &&
+ "gRPC library not initialized. See "
+ "grpc::internal::GrpcLibraryInitializer.");
+ g_glip->init();
+ grpc_init_called_ = true;
+ }
}
virtual ~GrpcLibraryCodegen() {
- GPR_CODEGEN_ASSERT(g_glip &&
- "gRPC library not initialized. See "
- "grpc::internal::GrpcLibraryInitializer.");
- g_glip->shutdown();
+ if (grpc_init_called_) {
+ GPR_CODEGEN_ASSERT(g_glip &&
+ "gRPC library not initialized. See "
+ "grpc::internal::GrpcLibraryInitializer.");
+ g_glip->shutdown();
+ }
}
+
+ private:
+ bool grpc_init_called_;
};
} // namespace grpc
diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h
index bf9a9b6f1a..91f0be06e7 100644
--- a/include/grpc++/impl/codegen/server_context.h
+++ b/include/grpc++/impl/codegen/server_context.h
@@ -39,7 +39,6 @@
#include <vector>
#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/load_reporting.h>
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/create_auth_context.h>
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index 3e54405974..489937712e 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -88,6 +88,8 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen {
virtual void PostSynchronousRequest(ServerContext* context) = 0;
/// Called before server is started.
virtual void PreServerStart(Server* server) {}
+ /// Called after a server port is added.
+ virtual void AddPort(Server* server, int port) {}
};
/// 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