Commit 81cd2d50 authored by Michael Smith's avatar Michael Smith

Implement killsource admin command, to kill sources. Doesn't always do much,

ices (as an example) will auto-reconnect.

svn path=/trunk/icecast/; revision=4571
parent ed019c0c
......@@ -34,6 +34,7 @@
/* Client management commands */
#define COMMAND_KILL_CLIENT 201
#define COMMAND_KILL_SOURCE 202
int admin_get_command(char *command)
{
......@@ -55,6 +56,8 @@ int admin_get_command(char *command)
return COMMAND_MOVE_CLIENTS;
else if(!strcmp(command, "killclient"))
return COMMAND_KILL_CLIENT;
else if(!strcmp(command, "killsource"))
return COMMAND_KILL_SOURCE;
else
return COMMAND_ERROR;
}
......@@ -68,6 +71,7 @@ static void command_raw_stats(client_t *client);
static void command_list_mounts(client_t *client, int formatted);
static void command_kill_client(client_t *client, source_t *source);
static void command_kill_source(client_t *client, source_t *source);
static void admin_handle_mount_request(client_t *client, source_t *source,
int command);
......@@ -177,6 +181,9 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
case COMMAND_KILL_CLIENT:
command_kill_client(client, source);
break;
case COMMAND_KILL_SOURCE:
command_kill_source(client, source);
break;
default:
WARN0("Mount request not recognised");
client_send_400(client, "Mount request unknown");
......@@ -300,6 +307,13 @@ static void command_show_listeners(client_t *client, source_t *source)
client_destroy(client);
}
static void command_kill_source(client_t *client, source_t *source)
{
source->running = 0;
html_success(client, "Removing source");
}
static void command_kill_client(client_t *client, source_t *source)
{
char *idtext;
......
......@@ -597,7 +597,7 @@ void *source_main(void *arg)
done:
DEBUG0("Source exiting");
INFO1("Source \"%s\" exiting", source->mount);
#ifdef HAVE_CURL
if(!suppress_yp) {
......
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