From 4f678aa244156a21e37fee698bc0ad0bb41a477a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 17 Jul 2018 23:11:33 +0200 Subject: [PATCH] neighbor/Glue: use struct ConfigData --- src/Main.cxx | 3 ++- src/neighbor/Glue.cxx | 7 ++++--- src/neighbor/Glue.hxx | 4 +++- test/run_neighbor_explorer.cxx | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index 6a29de7e0..831aa82b1 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -515,7 +515,8 @@ try { #ifdef ENABLE_NEIGHBOR_PLUGINS instance->neighbors = new NeighborGlue(); - instance->neighbors->Init(instance->io_thread.GetEventLoop(), + instance->neighbors->Init(raw_config, + instance->io_thread.GetEventLoop(), *instance); if (instance->neighbors->IsEmpty()) { diff --git a/src/neighbor/Glue.cxx b/src/neighbor/Glue.cxx index 8ba1013c7..5118f54a3 100644 --- a/src/neighbor/Glue.cxx +++ b/src/neighbor/Glue.cxx @@ -23,7 +23,7 @@ #include "Explorer.hxx" #include "NeighborPlugin.hxx" #include "Info.hxx" -#include "config/Global.hxx" +#include "config/Data.hxx" #include "config/Domain.hxx" #include "config/Block.hxx" #include "util/RuntimeError.hxx" @@ -50,9 +50,10 @@ CreateNeighborExplorer(EventLoop &loop, NeighborListener &listener, } void -NeighborGlue::Init(EventLoop &loop, NeighborListener &listener) +NeighborGlue::Init(const ConfigData &config, + EventLoop &loop, NeighborListener &listener) { - for (const auto *block = config_get_block(ConfigBlockOption::NEIGHBORS); + for (const auto *block = config.GetBlock(ConfigBlockOption::NEIGHBORS); block != nullptr; block = block->next) { block->SetUsed(); diff --git a/src/neighbor/Glue.hxx b/src/neighbor/Glue.hxx index 914419845..732841511 100644 --- a/src/neighbor/Glue.hxx +++ b/src/neighbor/Glue.hxx @@ -27,6 +27,7 @@ #include #include +struct ConfigData; class EventLoop; class NeighborExplorer; class NeighborListener; @@ -64,7 +65,8 @@ public: /** * Throws std::runtime_error on error. */ - void Init(EventLoop &loop, NeighborListener &listener); + void Init(const ConfigData &config, EventLoop &loop, + NeighborListener &listener); void Open(); void Close() noexcept; diff --git a/test/run_neighbor_explorer.cxx b/test/run_neighbor_explorer.cxx index f836bc148..7f78826f2 100644 --- a/test/run_neighbor_explorer.cxx +++ b/test/run_neighbor_explorer.cxx @@ -79,7 +79,7 @@ try { MyNeighborListener listener; NeighborGlue neighbor; - neighbor.Init(loop, listener); + neighbor.Init(GetGlobalConfig(), loop, listener); neighbor.Open(); /* dump initial list */