From b24028f6204a217690aabf5617756ca71dcb9ae7 Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Mon, 2 Feb 2004 19:22:11 +0000 Subject: [PATCH] recheck the relays after the HUP has been handled svn path=/trunk/icecast/; revision=5807 --- src/event.c | 2 ++ src/slave.c | 19 ++++++++++--------- src/slave.h | 1 + 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/event.c b/src/event.c index d9597152..c676f993 100644 --- a/src/event.c +++ b/src/event.c @@ -21,6 +21,7 @@ #include "refbuf.h" #include "client.h" #include "logging.h" +#include "slave.h" #define CATMODULE "event" @@ -57,6 +58,7 @@ void event_config_read(void *arg) config_clear(config); config_set_config(&new_config); restart_logging (); + slave_recheck(); yp_recheck_config (config); config_release_config(); diff --git a/src/slave.c b/src/slave.c index 4f297551..7ddfcd37 100644 --- a/src/slave.c +++ b/src/slave.c @@ -62,6 +62,14 @@ static void *_slave_thread(void *arg); thread_type *_slave_thread_id; static int _initialized = 0; +static unsigned max_interval = 0; + + +void slave_recheck (void) +{ + max_interval = 0; +} + void slave_initialize(void) { ice_config_t *config; @@ -150,19 +158,12 @@ static void create_relay_stream(char *server, int port, static void *_slave_thread(void *arg) { sock_t mastersock; char buf[256]; - int interval; + unsigned interval = 0; char *authheader, *data; int len; char *username = "relay"; - int max_interval; relay_server *relay; ice_config_t *config; - - config = config_get_config(); - - interval = max_interval = config->master_update_interval; - - config_release_config(); while (_initialized) { if (max_interval > ++interval) { @@ -252,7 +253,7 @@ static void *_slave_thread(void *arg) { thread_mutex_unlock(&(config_locks()->relay_lock)); } - thread_exit(0); + INFO0 ("Slave thread shutting down"); return NULL; } diff --git a/src/slave.h b/src/slave.h index 960df547..a07705c8 100644 --- a/src/slave.h +++ b/src/slave.h @@ -15,5 +15,6 @@ void slave_initialize(void); void slave_shutdown(void); +void slave_recheck (void); #endif /* __SLAVE_H__ */