mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Update: Make use of listensocket_container_set_sockcount_cb() and listensocket_container_sockcount()
This fixes the starts-up-with-no-listen-sockets bug.
This commit is contained in:
parent
c401bbcc12
commit
4279a6caea
@ -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 */
|
/* called when listening thread is not checking for incoming connections */
|
||||||
void connection_setup_sockets (ice_config_t *config)
|
void connection_setup_sockets (ice_config_t *config)
|
||||||
{
|
{
|
||||||
@ -1663,6 +1675,7 @@ void connection_setup_sockets (ice_config_t *config)
|
|||||||
|
|
||||||
global_unlock();
|
global_unlock();
|
||||||
|
|
||||||
|
listensocket_container_set_sockcount_cb(global.listensockets, __on_sock_count, NULL);
|
||||||
listensocket_container_setup(global.listensockets);;
|
listensocket_container_setup(global.listensockets);;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
#include "yp.h"
|
#include "yp.h"
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "listensocket.h"
|
||||||
|
|
||||||
#include <libxml/xmlmemory.h>
|
#include <libxml/xmlmemory.h>
|
||||||
|
|
||||||
@ -377,6 +378,11 @@ static int _server_proc_init(void)
|
|||||||
|
|
||||||
connection_setup_sockets(config);
|
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);
|
pidfile_update(config, 1);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user