1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

make inactive on-demand relays show up on xsl pages

svn path=/icecast/branches/kh/icecast/; revision=7620
This commit is contained in:
Karl Heyes 2004-08-24 00:02:40 +00:00
parent e20dc5a895
commit 13dfaffadc
3 changed files with 30 additions and 27 deletions

View File

@ -77,6 +77,10 @@ source_t *source_reserve (const char *mount)
do
{
unsigned int listen_url_size;
char *listenurl;
ice_config_t *config;
avl_tree_wlock (global.source_tree);
src = source_find_mount_raw (mount);
if (src)
@ -99,6 +103,25 @@ source_t *source_reserve (const char *mount)
avl_insert (global.source_tree, src);
config = config_get_config();
/* 6 for max size of port */
listen_url_size = strlen("http://") + strlen(config->hostname) +
strlen(":") + 6 + strlen(mount) + 1;
listenurl = malloc (listen_url_size);
if (listenurl)
{
snprintf (listenurl, listen_url_size, "http://%s:%d%s",
config->hostname, config->port, mount);
stats_event (mount, "listenurl", listenurl);
free(listenurl);
}
config_release_config();
stats_event (mount, "listeners", "0");
} while (0);
avl_tree_unlock (global.source_tree);
@ -284,6 +307,8 @@ void source_free_source (source_t *source)
avl_tree_wlock (global.source_tree);
avl_delete (global.source_tree, source, NULL);
avl_tree_unlock (global.source_tree);
stats_event (source->mount, "listeners", NULL);
stats_event (source->mount, NULL, NULL);
/* There should be no listeners on this mount */
if (source->active_clients)
@ -651,27 +676,7 @@ static void get_next_buffer (source_t *source)
static void source_init (source_t *source)
{
ice_config_t *config = config_get_config();
char *listenurl, *str = NULL;
int listen_url_size;
/* 6 for max size of port */
listen_url_size = strlen("http://") + strlen(config->hostname) +
strlen(":") + 6 + strlen(source->mount) + 1;
listenurl = malloc (listen_url_size);
if (listenurl)
{
snprintf (listenurl, listen_url_size, "http://%s:%d%s",
config->hostname, config->port, source->mount);
config_release_config();
stats_event (source->mount, "listenurl", listenurl);
free(listenurl);
}
else
config_release_config();
char *str = NULL;
thread_mutex_lock (&source->lock);
if (source->yp_prevent == 0)
@ -728,7 +733,6 @@ static void source_init (source_t *source)
source->listeners = 0;
stats_event_inc (NULL, "sources");
stats_event_inc (NULL, "source_total_connections");
stats_event (source->mount, "listeners", "0");
stats_event (source->mount, "type", source->format->format_description);
sock_set_blocking (source->con->sock, SOCK_NONBLOCK);
@ -1091,7 +1095,6 @@ static void source_shutdown (source_t *source)
/* delete this sources stats */
stats_event_dec (NULL, "sources");
stats_event (source->mount, "listeners", NULL);
/* we don't remove the source from the tree here, it may be a relay and
therefore reserved */

View File

@ -155,7 +155,7 @@ stats_t *stats_get_stats()
return NULL;
}
void stats_event(char *source, char *name, char *value)
void stats_event(const char *source, char *name, char *value)
{
stats_event_t *node;
stats_event_t *event;
@ -183,7 +183,7 @@ void stats_event(char *source, char *name, char *value)
thread_mutex_unlock(&_global_event_mutex);
}
void stats_event_args(char *source, char *name, char *format, ...)
void stats_event_args(const char *source, char *name, char *format, ...)
{
char buf[1024];
va_list val;

View File

@ -77,8 +77,8 @@ void stats_shutdown();
stats_t *stats_get_stats();
void stats_event(char *source, char *name, char *value);
void stats_event_args(char *source, char *name, char *format, ...);
void stats_event(const char *source, char *name, char *value);
void stats_event_args(const char *source, char *name, char *format, ...);
void stats_event_inc(char *source, char *name);
void stats_event_add(char *source, char *name, unsigned long value);
void stats_event_dec(char *source, char *name);