Listen: simplify code flow in listen_global_init()

This commit is contained in:
Max Kellermann 2018-07-15 21:34:16 +02:00
parent 56bfff5a57
commit 524a7f4560

View File

@ -82,18 +82,14 @@ void
listen_global_init(ClientListener &listener)
{
int port = config_get_positive(ConfigOption::PORT, DEFAULT_PORT);
const auto *param = config_get_param(ConfigOption::BIND_TO_ADDRESS);
#ifdef ENABLE_SYSTEMD_DAEMON
if (listen_systemd_activation(listener))
return;
#endif
if (param != nullptr) {
/* "bind_to_address" is configured, create listeners
for all values */
do {
for (const auto *param = config_get_param(ConfigOption::BIND_TO_ADDRESS);
param != nullptr; param = param->next) {
try {
listen_add_config_param(listener, port, param);
} catch (...) {
@ -101,8 +97,9 @@ listen_global_init(ClientListener &listener)
param->value.c_str(),
param->line));
}
} while ((param = param->next) != nullptr);
} else {
}
if (listener.IsEmpty()) {
/* no "bind_to_address" configured, bind the
configured port on all interfaces */