Commit 2c67cfff authored by Karl Heyes's avatar Karl Heyes

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
parent d327fc89
......@@ -177,7 +177,7 @@ static void command_show_listeners(client_t *client, source_t *source,
int response);
static void command_move_clients(client_t *client, source_t *source,
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_kill_client(client_t *client, source_t *source,
int response);
......@@ -435,7 +435,7 @@ static void admin_handle_general_request(client_t *client, int command)
{
switch(command) {
case COMMAND_RAW_STATS:
command_stats(client, RAW);
command_stats(client, NULL, RAW);
break;
case COMMAND_RAW_LIST_MOUNTS:
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);
break;
case COMMAND_TRANSFORMED_STATS:
command_stats(client, TRANSFORMED);
command_stats(client, NULL, TRANSFORMED);
break;
case COMMAND_TRANSFORMED_LIST_MOUNTS:
command_list_mounts(client, TRANSFORMED);
......@@ -469,6 +469,9 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
int command)
{
switch(command) {
case COMMAND_RAW_STATS:
command_stats(client, source->mount, RAW);
break;
case COMMAND_RAW_FALLBACK:
command_fallback(client, source, RAW);
break;
......@@ -493,6 +496,9 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
case COMMAND_RAW_KILL_SOURCE:
command_kill_source(client, source, RAW);
break;
case COMMAND_TRANSFORMED_STATS:
command_stats(client, source->mount, TRANSFORMED);
break;
case COMMAND_TRANSFORMED_FALLBACK:
command_fallback(client, source, RAW);
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;
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);
xmlFreeDoc(doc);
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment