Listen: use struct ConfigData

This commit is contained in:
Max Kellermann 2018-07-17 23:02:53 +02:00
parent 0b4e0b7bcb
commit 3983caa2c8
3 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,7 @@
#include "Listen.hxx"
#include "client/Listener.hxx"
#include "config/Param.hxx"
#include "config/Global.hxx"
#include "config/Data.hxx"
#include "config/Option.hxx"
#include "system/Error.hxx"
#include "util/RuntimeError.hxx"
@ -79,16 +79,16 @@ listen_systemd_activation(ClientListener &listener)
#endif
void
listen_global_init(ClientListener &listener)
listen_global_init(const ConfigData &config, ClientListener &listener)
{
int port = config_get_positive(ConfigOption::PORT, DEFAULT_PORT);
int port = config.GetPositive(ConfigOption::PORT, DEFAULT_PORT);
#ifdef ENABLE_SYSTEMD_DAEMON
if (listen_systemd_activation(listener))
return;
#endif
for (const auto *param = config_get_param(ConfigOption::BIND_TO_ADDRESS);
for (const auto *param = config.GetParam(ConfigOption::BIND_TO_ADDRESS);
param != nullptr; param = param->next) {
try {
listen_add_config_param(listener, port, param);

View File

@ -20,11 +20,12 @@
#ifndef MPD_LISTEN_HXX
#define MPD_LISTEN_HXX
struct ConfigData;
class ClientListener;
extern int listen_port;
void
listen_global_init(ClientListener &listener);
listen_global_init(const ConfigData &config, ClientListener &listener);
#endif

View File

@ -530,7 +530,7 @@ try {
initialize_decoder_and_player(raw_config, config.replay_gain);
listen_global_init(*instance->partitions.front().listener);
listen_global_init(raw_config, *instance->partitions.front().listener);
#ifdef ENABLE_DAEMON
daemonize_set_user();