2004-01-28 20:02:12 -05:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
2003-07-20 21:58:54 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-03-05 08:03:35 -05:00
|
|
|
#include "event.h"
|
2003-07-20 21:58:54 -04:00
|
|
|
#include "cfgfile.h"
|
2004-01-26 17:42:22 -05:00
|
|
|
#include "yp.h"
|
2005-05-15 20:16:12 -04:00
|
|
|
#include "source.h"
|
2003-03-05 08:03:35 -05:00
|
|
|
|
|
|
|
#include "refbuf.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "logging.h"
|
2004-02-02 14:22:11 -05:00
|
|
|
#include "slave.h"
|
2007-08-13 17:33:27 -04:00
|
|
|
#include "fserve.h"
|
2007-08-15 22:13:18 -04:00
|
|
|
#include "stats.h"
|
2003-03-05 08:03:35 -05:00
|
|
|
|
|
|
|
#define CATMODULE "event"
|
|
|
|
|
|
|
|
void event_config_read(void *arg)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
ice_config_t *config;
|
|
|
|
ice_config_t new_config;
|
2003-03-14 21:10:19 -05:00
|
|
|
/* reread config file */
|
2003-03-05 08:03:35 -05:00
|
|
|
|
2005-04-20 18:34:54 -04:00
|
|
|
config = config_grab_config(); /* Both to get the lock, and to be able
|
2003-03-05 08:03:35 -05:00
|
|
|
to find out the config filename */
|
2005-08-16 12:56:24 -04:00
|
|
|
xmlSetGenericErrorFunc ("config", log_parse_failure);
|
2003-03-05 08:03:35 -05:00
|
|
|
ret = config_parse_file(config->config_filename, &new_config);
|
|
|
|
if(ret < 0) {
|
2014-10-31 04:46:58 -04:00
|
|
|
ICECAST_LOG_ERROR("Error parsing config, not replacing existing config");
|
2003-03-05 08:03:35 -05:00
|
|
|
switch(ret) {
|
|
|
|
case CONFIG_EINSANE:
|
2014-10-31 04:46:58 -04:00
|
|
|
ICECAST_LOG_ERROR("Config filename null or blank");
|
2003-03-05 08:03:35 -05:00
|
|
|
break;
|
|
|
|
case CONFIG_ENOROOT:
|
2014-10-31 04:46:58 -04:00
|
|
|
ICECAST_LOG_ERROR("Root element not found in %s", config->config_filename);
|
2003-03-05 08:03:35 -05:00
|
|
|
break;
|
|
|
|
case CONFIG_EBADROOT:
|
2014-10-31 04:46:58 -04:00
|
|
|
ICECAST_LOG_ERROR("Not an icecast2 config file: %s",
|
2003-03-05 08:03:35 -05:00
|
|
|
config->config_filename);
|
|
|
|
break;
|
|
|
|
default:
|
2014-10-31 04:46:58 -04:00
|
|
|
ICECAST_LOG_ERROR("Parse error in reading %s", config->config_filename);
|
2003-03-05 08:03:35 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
config_release_config();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
config_clear(config);
|
|
|
|
config_set_config(&new_config);
|
2007-08-15 22:13:18 -04:00
|
|
|
config = config_get_config_unlocked();
|
|
|
|
restart_logging (config);
|
|
|
|
yp_recheck_config (config);
|
|
|
|
fserve_recheck_mime_types (config);
|
|
|
|
stats_global (config);
|
2003-03-05 08:03:35 -05:00
|
|
|
config_release_config();
|
2007-10-21 22:29:49 -04:00
|
|
|
slave_update_all_mounts();
|
2003-03-05 08:03:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|