void fserve_initialize(void) { if (fserve_running) return; ice_config_t *config = config_get_config(); mimetypes = NULL; thread_spin_create (&pending_lock); #ifndef HAVE_PREAD thread_mutex_create (&seekread_lock); #endif fh_cache = avl_tree_new (_compare_fh, NULL); fserve_recheck_mime_types (config); config_release_config(); stats_event_flags (NULL, "file_connections", "0", STATS_COUNTERS); fserve_running = 1; memset (&no_file, 0, sizeof (no_file)); thread_mutex_create (&no_file.lock); no_file.clients = avl_tree_new (client_compare, NULL); no_file.refcount = 1; no_file.expire = (time_t)-1; no_file.f = -1; avl_insert (fh_cache, &no_file); INFO0("file serving started"); }
void event_config_read (void) { int ret; ice_config_t *config; ice_config_t new_config, old_config; /* reread config file */ INFO0("Re-reading XML"); config = config_grab_config(); /* Both to get the lock, and to be able to find out the config filename */ xmlSetGenericErrorFunc (config->config_filename, log_parse_failure); xmlSetStructuredErrorFunc ("conf/file", config_xml_parse_failure); ret = config_parse_file(config->config_filename, &new_config); if(ret < 0) { ERROR0("Error parsing config, not replacing existing config"); switch(ret) { case CONFIG_EINSANE: ERROR0("Config filename null or blank"); break; case CONFIG_ENOROOT: ERROR1("Root element not found in %s", config->config_filename); break; case CONFIG_EBADROOT: ERROR1("Not an icecast2 config file: %s", config->config_filename); break; default: ERROR1("Parse error in reading %s", config->config_filename); break; } config_release_config(); } else { restart_logging (&new_config); config_set_config (&new_config, &old_config); config_release_config(); connection_thread_shutdown(); redirector_clearall(); fserve_scan ((time_t)0); config = config_get_config(); yp_recheck_config (config); fserve_recheck_mime_types (config); stats_global (config); workers_adjust (config->workers_count); connection_listen_sockets_close (config, 0); redirector_setup (config); update_relays (config); config_release_config(); slave_restart(); config_clear (&old_config); } }
void fserve_initialize(void) { ice_config_t *config = config_get_config(); mimetypes = NULL; active_list = NULL; pending_list = NULL; thread_spin_create (&pending_lock); fserve_recheck_mime_types (config); config_release_config(); stats_event (NULL, "file_connections", "0"); INFO0("file serving started"); }
void event_config_read(void *arg) { int ret; ice_config_t *config; ice_config_t new_config; /* reread config file */ config = config_grab_config(); /* Both to get the lock, and to be able to find out the config filename */ xmlSetGenericErrorFunc ("config", log_parse_failure); ret = config_parse_file(config->config_filename, &new_config); if(ret < 0) { ICECAST_LOG_ERROR("Error parsing config, not replacing existing config"); switch(ret) { case CONFIG_EINSANE: ICECAST_LOG_ERROR("Config filename null or blank"); break; case CONFIG_ENOROOT: ICECAST_LOG_ERROR("Root element not found in %s", config->config_filename); break; case CONFIG_EBADROOT: ICECAST_LOG_ERROR("Not an icecast2 config file: %s", config->config_filename); break; default: ICECAST_LOG_ERROR("Parse error in reading %s", config->config_filename); break; } config_release_config(); } else { config_clear(config); config_set_config(&new_config); config = config_get_config_unlocked(); restart_logging (config); yp_recheck_config (config); fserve_recheck_mime_types (config); stats_global (config); config_release_config(); slave_update_all_mounts(); } }