diff options
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/server/server_builder.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index b6e48efa8d..9658a56745 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -41,18 +41,20 @@ namespace grpc { -static std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>* plugin_list; +static std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>* + g_plugin_factory_list; static gpr_once once_init_plugin_list = GPR_ONCE_INIT; static void do_plugin_list_init(void) { - plugin_list = new std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>(); + g_plugin_factory_list = + new std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>(); } ServerBuilder::ServerBuilder() : max_message_size_(-1), generic_service_(nullptr) { grpc_compression_options_init(&compression_options_); gpr_once_init(&once_init_plugin_list, do_plugin_list_init); - for (auto factory : (*plugin_list)) { + for (auto factory : (*g_plugin_factory_list)) { std::unique_ptr<ServerBuilderPlugin> plugin = factory(); plugins_[plugin->name()] = std::move(plugin); } @@ -171,7 +173,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { void ServerBuilder::InternalAddPluginFactory( std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)()) { gpr_once_init(&once_init_plugin_list, do_plugin_list_init); - (*plugin_list).push_back(CreatePlugin); + (*g_plugin_factory_list).push_back(CreatePlugin); } } // namespace grpc |