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 "Listen.hxx"
#include "client/Listener.hxx" #include "client/Listener.hxx"
#include "config/Param.hxx" #include "config/Param.hxx"
#include "config/Global.hxx" #include "config/Data.hxx"
#include "config/Option.hxx" #include "config/Option.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
@ -79,16 +79,16 @@ listen_systemd_activation(ClientListener &listener)
#endif #endif
void 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 #ifdef ENABLE_SYSTEMD_DAEMON
if (listen_systemd_activation(listener)) if (listen_systemd_activation(listener))
return; return;
#endif #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) { param != nullptr; param = param->next) {
try { try {
listen_add_config_param(listener, port, param); listen_add_config_param(listener, port, param);

View File

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

View File

@ -530,7 +530,7 @@ try {
initialize_decoder_and_player(raw_config, config.replay_gain); 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 #ifdef ENABLE_DAEMON
daemonize_set_user(); daemonize_set_user();