mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-11-03 04:17:17 -05:00
add 2 extra stats, and send a max listener setting to YP
svn path=/icecast/branches/kh/icecast/; revision=8211
This commit is contained in:
parent
905ae4a79f
commit
4987a4265d
@ -334,6 +334,7 @@ static void _build_pool(void)
|
||||
|
||||
config = config_get_config();
|
||||
threadpool_size = config->threadpool_size;
|
||||
source_update (config);
|
||||
config_release_config();
|
||||
|
||||
for (i = 0; i < threadpool_size; i++) {
|
||||
|
@ -1327,6 +1327,12 @@ void source_update_settings (ice_config_t *config, source_t *source)
|
||||
void source_update (ice_config_t *config)
|
||||
{
|
||||
avl_node *node;
|
||||
char limit [20];
|
||||
|
||||
snprintf (limit, sizeof (limit), "%d", config->client_limit);
|
||||
stats_event (NULL, "client_limit", limit);
|
||||
snprintf (limit, sizeof (limit), "%d", config->source_limit);
|
||||
stats_event (NULL, "source_limit", limit);
|
||||
|
||||
avl_tree_rlock (global.source_tree);
|
||||
node = avl_get_first (global.source_tree);
|
||||
|
13
src/yp.c
13
src/yp.c
@ -364,6 +364,7 @@ static unsigned do_yp_touch (ypdata_t *yp, char *s, unsigned len)
|
||||
unsigned listeners = 0;
|
||||
char *val, *artist, *title;
|
||||
int ret;
|
||||
char *max_listeners;
|
||||
|
||||
artist = (char *)stats_get_value (yp->mount, "artist");
|
||||
title = (char *)stats_get_value (yp->mount, "title");
|
||||
@ -394,8 +395,16 @@ static unsigned do_yp_touch (ypdata_t *yp, char *s, unsigned len)
|
||||
listeners = atoi (val);
|
||||
free (val);
|
||||
}
|
||||
ret = snprintf (s, len, "action=touch&sid=%s&st=%s&listeners=%u\r\n",
|
||||
yp->sid, yp->current_song, listeners);
|
||||
max_listeners = stats_get_value (yp->mount, "max_listeners");
|
||||
if (max_listeners == NULL || strcmp (max_listeners, "unlimited") == 0)
|
||||
{
|
||||
free (max_listeners);
|
||||
max_listeners = (char *)stats_get_value (NULL, "client_limit");
|
||||
}
|
||||
|
||||
ret = snprintf (s, len, "action=touch&sid=%s&st=%s"
|
||||
"&listeners=%u&max_listeners=%s\r\n",
|
||||
yp->sid, yp->current_song, listeners, max_listeners);
|
||||
|
||||
if (ret >= (signed)len)
|
||||
return ret+1; /* space required for above text and nul*/
|
||||
|
Loading…
Reference in New Issue
Block a user