1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-01-03 14:56:34 -05:00

Fix: Remove locking from signal handler

See also: #2472
This commit is contained in:
Philipp Schafft 2023-06-03 19:30:59 +00:00
parent 00f8e94257
commit d42646541c
4 changed files with 11 additions and 6 deletions

View File

@ -147,6 +147,7 @@ AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPES([sig_atomic_t], [], [], [[#include <signal.h>]])
dnl Checks for required libraries

View File

@ -21,6 +21,8 @@
#define ICECAST_VERSION_STRING "Icecast " PACKAGE_VERSION
#include <signal.h>
#include <igloo/igloo.h>
#include "common/thread/thread.h"
@ -37,7 +39,12 @@ typedef struct ice_global_tag
time_t sources_update;
int sources_legacy;
int clients;
int schedule_config_reread;
#ifdef HAVE_SIG_ATOMIC_T
volatile sig_atomic_t schedule_config_reread;
#else
volatile int schedule_config_reread;
#endif
avl_tree *source_tree;
/* for locally defined relays */

View File

@ -54,11 +54,7 @@ void _sig_ignore(int signo)
void _sig_hup(int signo)
{
ICECAST_LOG_INFO("Caught signal %d, scheduling config re-read...", signo);
global_lock();
global . schedule_config_reread = 1;
global_unlock();
global.schedule_config_reread = 1;
/* some OSes require us to reattach the signal handler */
signal(SIGHUP, _sig_hup);

View File

@ -883,6 +883,7 @@ static void *_slave_thread(void *arg)
/* re-read xml file if requested */
global_lock();
if (global.schedule_config_reread) {
ICECAST_LOG_INFO("Reloading config for reload was queued");
config_reread_config();
global.schedule_config_reread = 0;
}