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

fix for #734. Allow /admin/stats[.xsl] to take an optional mount arg which only

returns global stats and stats for that particular mountpoint.


svn path=/icecast/trunk/icecast/; revision=13709
This commit is contained in:
Karl Heyes 2007-09-03 22:04:04 +00:00
parent d327fc8914
commit 2c67cfffb2

View File

@ -177,7 +177,7 @@ static void command_show_listeners(client_t *client, source_t *source,
int response); int response);
static void command_move_clients(client_t *client, source_t *source, static void command_move_clients(client_t *client, source_t *source,
int response); int response);
static void command_stats(client_t *client, int response); static void command_stats(client_t *client, const char *mount, int response);
static void command_list_mounts(client_t *client, int response); static void command_list_mounts(client_t *client, int response);
static void command_kill_client(client_t *client, source_t *source, static void command_kill_client(client_t *client, source_t *source,
int response); int response);
@ -435,7 +435,7 @@ static void admin_handle_general_request(client_t *client, int command)
{ {
switch(command) { switch(command) {
case COMMAND_RAW_STATS: case COMMAND_RAW_STATS:
command_stats(client, RAW); command_stats(client, NULL, RAW);
break; break;
case COMMAND_RAW_LIST_MOUNTS: case COMMAND_RAW_LIST_MOUNTS:
command_list_mounts(client, RAW); command_list_mounts(client, RAW);
@ -447,7 +447,7 @@ static void admin_handle_general_request(client_t *client, int command)
command_list_mounts(client, PLAINTEXT); command_list_mounts(client, PLAINTEXT);
break; break;
case COMMAND_TRANSFORMED_STATS: case COMMAND_TRANSFORMED_STATS:
command_stats(client, TRANSFORMED); command_stats(client, NULL, TRANSFORMED);
break; break;
case COMMAND_TRANSFORMED_LIST_MOUNTS: case COMMAND_TRANSFORMED_LIST_MOUNTS:
command_list_mounts(client, TRANSFORMED); command_list_mounts(client, TRANSFORMED);
@ -469,6 +469,9 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
int command) int command)
{ {
switch(command) { switch(command) {
case COMMAND_RAW_STATS:
command_stats(client, source->mount, RAW);
break;
case COMMAND_RAW_FALLBACK: case COMMAND_RAW_FALLBACK:
command_fallback(client, source, RAW); command_fallback(client, source, RAW);
break; break;
@ -493,6 +496,9 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
case COMMAND_RAW_KILL_SOURCE: case COMMAND_RAW_KILL_SOURCE:
command_kill_source(client, source, RAW); command_kill_source(client, source, RAW);
break; break;
case COMMAND_TRANSFORMED_STATS:
command_stats(client, source->mount, TRANSFORMED);
break;
case COMMAND_TRANSFORMED_FALLBACK: case COMMAND_TRANSFORMED_FALLBACK:
command_fallback(client, source, RAW); command_fallback(client, source, RAW);
break; break;
@ -949,12 +955,12 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
} }
} }
static void command_stats(client_t *client, int response) { static void command_stats(client_t *client, const char *mount, int response) {
xmlDocPtr doc; xmlDocPtr doc;
DEBUG0("Stats request, sending xml stats"); DEBUG0("Stats request, sending xml stats");
stats_get_xml(&doc, 1, NULL); stats_get_xml(&doc, 1, mount);
admin_send_response(doc, client, response, STATS_TRANSFORMED_REQUEST); admin_send_response(doc, client, response, STATS_TRANSFORMED_REQUEST);
xmlFreeDoc(doc); xmlFreeDoc(doc);
return; return;