Commit e609c883 authored by Max Kellermann's avatar Max Kellermann

Listen: reduce overhead for builds without systemd

parent e92a41fa
...@@ -77,10 +77,11 @@ listen_add_config_param(unsigned int port, ...@@ -77,10 +77,11 @@ listen_add_config_param(unsigned int port,
} }
} }
#ifdef ENABLE_SYSTEMD_DAEMON
static bool static bool
listen_systemd_activation(Error &error_r) listen_systemd_activation(Error &error_r)
{ {
#ifdef ENABLE_SYSTEMD_DAEMON
int n = sd_listen_fds(true); int n = sd_listen_fds(true);
if (n <= 0) { if (n <= 0) {
if (n < 0) if (n < 0)
...@@ -95,12 +96,10 @@ listen_systemd_activation(Error &error_r) ...@@ -95,12 +96,10 @@ listen_systemd_activation(Error &error_r)
return false; return false;
return true; return true;
#else
(void)error_r;
return false;
#endif
} }
#endif
bool bool
listen_global_init(EventLoop &loop, Partition &partition, Error &error) listen_global_init(EventLoop &loop, Partition &partition, Error &error)
{ {
...@@ -111,11 +110,13 @@ listen_global_init(EventLoop &loop, Partition &partition, Error &error) ...@@ -111,11 +110,13 @@ listen_global_init(EventLoop &loop, Partition &partition, Error &error)
listen_socket = new ClientListener(loop, partition); listen_socket = new ClientListener(loop, partition);
#ifdef ENABLE_SYSTEMD_DAEMON
if (listen_systemd_activation(error)) if (listen_systemd_activation(error))
return true; return true;
if (error.IsDefined()) if (error.IsDefined())
return false; return false;
#endif
if (param != nullptr) { if (param != nullptr) {
/* "bind_to_address" is configured, create listeners /* "bind_to_address" is configured, create listeners
......
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