1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

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
This commit is contained in:
Michael Smith 2003-03-31 12:54:44 +00:00
parent ed019c0cd6
commit 81cd2d50f5
2 changed files with 15 additions and 1 deletions

View File

@ -34,6 +34,7 @@
/* Client management commands */ /* Client management commands */
#define COMMAND_KILL_CLIENT 201 #define COMMAND_KILL_CLIENT 201
#define COMMAND_KILL_SOURCE 202
int admin_get_command(char *command) int admin_get_command(char *command)
{ {
@ -55,6 +56,8 @@ int admin_get_command(char *command)
return COMMAND_MOVE_CLIENTS; return COMMAND_MOVE_CLIENTS;
else if(!strcmp(command, "killclient")) else if(!strcmp(command, "killclient"))
return COMMAND_KILL_CLIENT; return COMMAND_KILL_CLIENT;
else if(!strcmp(command, "killsource"))
return COMMAND_KILL_SOURCE;
else else
return COMMAND_ERROR; 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_list_mounts(client_t *client, int formatted);
static void command_kill_client(client_t *client, source_t *source); 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, static void admin_handle_mount_request(client_t *client, source_t *source,
int command); int command);
@ -177,6 +181,9 @@ static void admin_handle_mount_request(client_t *client, source_t *source,
case COMMAND_KILL_CLIENT: case COMMAND_KILL_CLIENT:
command_kill_client(client, source); command_kill_client(client, source);
break; break;
case COMMAND_KILL_SOURCE:
command_kill_source(client, source);
break;
default: default:
WARN0("Mount request not recognised"); WARN0("Mount request not recognised");
client_send_400(client, "Mount request unknown"); 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); 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) static void command_kill_client(client_t *client, source_t *source)
{ {
char *idtext; char *idtext;

View File

@ -597,7 +597,7 @@ void *source_main(void *arg)
done: done:
DEBUG0("Source exiting"); INFO1("Source \"%s\" exiting", source->mount);
#ifdef HAVE_CURL #ifdef HAVE_CURL
if(!suppress_yp) { if(!suppress_yp) {