ZeroconfGlue: use struct ConfigData

This commit is contained in:
Max Kellermann 2018-07-17 22:44:16 +02:00
parent ad866f7a7d
commit bf582bd969
3 changed files with 10 additions and 9 deletions

View File

@ -593,7 +593,7 @@ try {
instance->neighbors->Open();
#endif
ZeroconfInit(instance->event_loop);
ZeroconfInit(GetGlobalConfig(), instance->event_loop);
for (auto &partition : instance->partitions)
StartPlayerThread(partition.pc);

View File

@ -21,7 +21,7 @@
#include "ZeroconfGlue.hxx"
#include "ZeroconfAvahi.hxx"
#include "ZeroconfBonjour.hxx"
#include "config/Global.hxx"
#include "config/Data.hxx"
#include "config/Option.hxx"
#include "Listen.hxx"
#include "util/Domain.hxx"
@ -40,12 +40,12 @@ static constexpr Domain zeroconf_domain("zeroconf");
static int zeroconfEnabled;
void
ZeroconfInit(gcc_unused EventLoop &loop)
ZeroconfInit(const ConfigData &config, gcc_unused EventLoop &loop)
{
const char *serviceName;
zeroconfEnabled = config_get_bool(ConfigOption::ZEROCONF_ENABLED,
DEFAULT_ZEROCONF_ENABLED);
zeroconfEnabled = config.GetBool(ConfigOption::ZEROCONF_ENABLED,
DEFAULT_ZEROCONF_ENABLED);
if (!zeroconfEnabled)
return;
@ -56,8 +56,8 @@ ZeroconfInit(gcc_unused EventLoop &loop)
return;
}
serviceName = config_get_string(ConfigOption::ZEROCONF_NAME,
SERVICE_NAME);
serviceName = config.GetString(ConfigOption::ZEROCONF_NAME,
SERVICE_NAME);
#ifdef HAVE_AVAHI
AvahiInit(loop, serviceName);

View File

@ -22,12 +22,13 @@
#include "check.h"
struct ConfigData;
class EventLoop;
#ifdef HAVE_ZEROCONF
void
ZeroconfInit(EventLoop &loop);
ZeroconfInit(const ConfigData &config, EventLoop &loop);
void
ZeroconfDeinit();
@ -35,7 +36,7 @@ ZeroconfDeinit();
#else /* ! HAVE_ZEROCONF */
static inline void
ZeroconfInit(EventLoop &)
ZeroconfInit(const ConfigData &, EventLoop &)
{}
static inline void