From 15855f3e7fbf8407393e70dd3c92ee2b0a871430 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 10 Jun 2016 12:25:32 -0700 Subject: Switch server builder plugin API to something that will work with gcc4.4 --- src/cpp/server/server_builder.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index ea5dfbfe8e..ff57c26497 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -57,12 +57,7 @@ ServerBuilder::ServerBuilder() for (auto it = g_plugin_factory_list->begin(); it != g_plugin_factory_list->end(); it++) { auto& factory = *it; - std::unique_ptr plugin = factory(); - auto name = plugin->name(); - ServerBuilderPlugin* plugin_ptr = plugin.release(); - plugins_[name] = nullptr; - auto pl = plugins_.find(name); - pl->second.reset(plugin_ptr); + plugins_.emplace_back(factory()); } } @@ -123,7 +118,7 @@ std::unique_ptr ServerBuilder::BuildAndStart() { } if (!thread_pool) { for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - if ((*plugin).second->has_sync_methods()) { + if ((*plugin)->has_sync_methods()) { thread_pool.reset(CreateDefaultThreadPool()); has_sync_methods = true; break; @@ -172,7 +167,7 @@ std::unique_ptr ServerBuilder::BuildAndStart() { } } for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - (*plugin).second->InitServer(initializer); + (*plugin)->InitServer(initializer); } if (generic_service_) { server->RegisterAsyncGenericService(generic_service_); @@ -198,7 +193,7 @@ std::unique_ptr ServerBuilder::BuildAndStart() { return nullptr; } for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - (*plugin).second->Finish(initializer); + (*plugin)->Finish(initializer); } return server; } -- cgit v1.2.3