1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00

Add accumulative stats back for source connections and don't hold locks

while writing responses back to the client.

svn path=/trunk/icecast/; revision=5853
This commit is contained in:
Karl Heyes 2004-02-20 17:42:57 +00:00
parent 7b7a9f73d2
commit 176804e436
4 changed files with 12 additions and 9 deletions

View File

@ -285,6 +285,7 @@ void admin_handle_request(client_t *client, char *uri)
{ {
WARN2("Admin command %s on non-existent source %s", WARN2("Admin command %s on non-existent source %s",
command_string, mount); command_string, mount);
avl_tree_unlock(global.source_tree);
client_send_400(client, "Source does not exist"); client_send_400(client, "Source does not exist");
} }
else else
@ -300,8 +301,8 @@ void admin_handle_request(client_t *client, char *uri)
INFO2("Received admin command %s on mount \"%s\"", INFO2("Received admin command %s on mount \"%s\"",
command_string, mount); command_string, mount);
admin_handle_mount_request(client, source, command); admin_handle_mount_request(client, source, command);
avl_tree_unlock(global.source_tree);
} }
avl_tree_unlock(global.source_tree);
} }
else { else {

View File

@ -480,6 +480,7 @@ int connection_complete_source (source_t *source)
global.sources++; global.sources++;
global_unlock(); global_unlock();
stats_event_inc(NULL, "sources"); stats_event_inc(NULL, "sources");
stats_event_inc(NULL, "source_total_connections");
/* for relays, we don't yet have a client, however we do require one /* for relays, we don't yet have a client, however we do require one
* to retrieve the stream from. This is created here, quite late, * to retrieve the stream from. This is created here, quite late,
@ -679,7 +680,6 @@ static void _handle_source_request(connection_t *con,
client = client_create(con, parser); client = client_create(con, parser);
INFO1("Source logging in at mountpoint \"%s\"", uri); INFO1("Source logging in at mountpoint \"%s\"", uri);
stats_event_inc(NULL, "source_connections");
if (!connection_check_source_pass(parser, uri)) { if (!connection_check_source_pass(parser, uri)) {
/* We commonly get this if the source client is using the wrong /* We commonly get this if the source client is using the wrong
@ -885,9 +885,9 @@ static void _handle_get_request(connection_t *con,
global_lock(); global_lock();
if (global.clients >= client_limit) { if (global.clients >= client_limit) {
client_send_504(client,
"The server is already full. Try again later.");
global_unlock(); global_unlock();
client_send_404(client,
"The server is already full. Try again later.");
return; return;
} }
global_unlock(); global_unlock();
@ -902,8 +902,8 @@ static void _handle_get_request(connection_t *con,
* the originally requested source * the originally requested source
*/ */
if(strcmp(uri, source->mount) == 0 && source->no_mount) { if(strcmp(uri, source->mount) == 0 && source->no_mount) {
client_send_404(client, "This mount is unavailable.");
avl_tree_unlock(global.source_tree); avl_tree_unlock(global.source_tree);
client_send_404(client, "This mount is unavailable.");
return; return;
} }
if (source->running == 0) if (source->running == 0)
@ -928,10 +928,10 @@ static void _handle_get_request(connection_t *con,
/* And then check that there's actually room in the server... */ /* And then check that there's actually room in the server... */
global_lock(); global_lock();
if (global.clients >= client_limit) { if (global.clients >= client_limit) {
client_send_504(client,
"The server is already full. Try again later.");
global_unlock(); global_unlock();
avl_tree_unlock(global.source_tree); avl_tree_unlock(global.source_tree);
client_send_404(client,
"The server is already full. Try again later.");
return; return;
} }
/* Early-out for per-source max listeners. This gets checked again /* Early-out for per-source max listeners. This gets checked again
@ -941,10 +941,10 @@ static void _handle_get_request(connection_t *con,
else if(source->max_listeners != -1 && else if(source->max_listeners != -1 &&
source->listeners >= source->max_listeners) source->listeners >= source->max_listeners)
{ {
client_send_504(client,
"Too many clients on this mountpoint. Try again later.");
global_unlock(); global_unlock();
avl_tree_unlock(global.source_tree); avl_tree_unlock(global.source_tree);
client_send_404(client,
"Too many clients on this mountpoint. Try again later.");
return; return;
} }
global.clients++; global.clients++;

View File

@ -99,6 +99,7 @@ static void *_relay_thread (void *arg)
relay_server *relay = arg; relay_server *relay = arg;
relay->running = 1; relay->running = 1;
stats_event_inc(NULL, "source_relay_connections");
source_main (relay->source); source_main (relay->source);

View File

@ -915,6 +915,7 @@ void *source_client_thread (void *arg)
source_t *source = arg; source_t *source = arg;
source->send_return = 1; source->send_return = 1;
stats_event_inc(NULL, "source_client_connections");
source_main (source); source_main (source);
source_free_source (source); source_free_source (source);
return NULL; return NULL;