Commit 4279a6ca authored by Philipp Schafft's avatar Philipp Schafft 🦁

Update: Make use of listensocket_container_set_sockcount_cb() and...

Update: Make use of listensocket_container_set_sockcount_cb() and listensocket_container_sockcount()

This fixes the starts-up-with-no-listen-sockets bug.
parent c401bbcc
......@@ -1634,6 +1634,18 @@ static void _handle_connection(void)
}
static void __on_sock_count(size_t count, void *userdata)
{
(void)userdata;
ICECAST_LOG_DEBUG("Listen socket count is now %zu.", count);
if (count == 0 && global.running == ICECAST_RUNNING) {
ICECAST_LOG_INFO("No more listen sockets. Exiting.");
global.running = ICECAST_HALTING;
}
}
/* called when listening thread is not checking for incoming connections */
void connection_setup_sockets (ice_config_t *config)
{
......@@ -1663,6 +1675,7 @@ void connection_setup_sockets (ice_config_t *config)
global_unlock();
listensocket_container_set_sockcount_cb(global.listensockets, __on_sock_count, NULL);
listensocket_container_setup(global.listensockets);;
}
......
......@@ -77,6 +77,7 @@
#include "yp.h"
#include "auth.h"
#include "event.h"
#include "listensocket.h"
#include <libxml/xmlmemory.h>
......@@ -377,6 +378,11 @@ static int _server_proc_init(void)
connection_setup_sockets(config);
if (listensocket_container_sockcount(global.listensockets) < 1) {
ICECAST_LOG_ERROR("Can not listen on any sockets.");
return 0;
}
pidfile_update(config, 1);
return 1;
......
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