Commit 4f678aa2 authored by Max Kellermann's avatar Max Kellermann

neighbor/Glue: use struct ConfigData

parent 3a4a430f
...@@ -515,7 +515,8 @@ try { ...@@ -515,7 +515,8 @@ try {
#ifdef ENABLE_NEIGHBOR_PLUGINS #ifdef ENABLE_NEIGHBOR_PLUGINS
instance->neighbors = new NeighborGlue(); instance->neighbors = new NeighborGlue();
instance->neighbors->Init(instance->io_thread.GetEventLoop(), instance->neighbors->Init(raw_config,
instance->io_thread.GetEventLoop(),
*instance); *instance);
if (instance->neighbors->IsEmpty()) { if (instance->neighbors->IsEmpty()) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "Explorer.hxx" #include "Explorer.hxx"
#include "NeighborPlugin.hxx" #include "NeighborPlugin.hxx"
#include "Info.hxx" #include "Info.hxx"
#include "config/Global.hxx" #include "config/Data.hxx"
#include "config/Domain.hxx" #include "config/Domain.hxx"
#include "config/Block.hxx" #include "config/Block.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
...@@ -50,9 +50,10 @@ CreateNeighborExplorer(EventLoop &loop, NeighborListener &listener, ...@@ -50,9 +50,10 @@ CreateNeighborExplorer(EventLoop &loop, NeighborListener &listener,
} }
void 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 != nullptr; block = block->next) {
block->SetUsed(); block->SetUsed();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <forward_list> #include <forward_list>
#include <memory> #include <memory>
struct ConfigData;
class EventLoop; class EventLoop;
class NeighborExplorer; class NeighborExplorer;
class NeighborListener; class NeighborListener;
...@@ -64,7 +65,8 @@ public: ...@@ -64,7 +65,8 @@ public:
/** /**
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
*/ */
void Init(EventLoop &loop, NeighborListener &listener); void Init(const ConfigData &config, EventLoop &loop,
NeighborListener &listener);
void Open(); void Open();
void Close() noexcept; void Close() noexcept;
......
...@@ -79,7 +79,7 @@ try { ...@@ -79,7 +79,7 @@ try {
MyNeighborListener listener; MyNeighborListener listener;
NeighborGlue neighbor; NeighborGlue neighbor;
neighbor.Init(loop, listener); neighbor.Init(GetGlobalConfig(), loop, listener);
neighbor.Open(); neighbor.Open();
/* dump initial list */ /* dump initial list */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment