Commit d43484d4 authored by Michael Smith's avatar Michael Smith

Fix various places where "clients" stats value was decremented without having

previously been incremented. 

svn path=/icecast/trunk/icecast/; revision=9074
parent 783e6580
......@@ -694,7 +694,7 @@ static void _handle_source_request(connection_t *con,
client = client_create(con, parser);
INFO1("Source logging in at mountpoint \"%s\"", uri);
if (uri[0] != '/')
{
WARN0 ("source mountpoint not starting with /");
......@@ -708,7 +708,7 @@ static void _handle_source_request(connection_t *con,
* protocol: attempt to diagnose this and return an error
*/
/* TODO: Do what the above comment says */
INFO1("Source (%s) attempted to login with invalid or missing password", uri);
WARN1("Source (%s) attempted to login with invalid or missing password", uri);
client_send_401(client);
return;
}
......@@ -787,7 +787,7 @@ static void _handle_get_request(connection_t *con,
fileserve = config->fileserve;
host = config->hostname;
port = config->port;
for(i = 0; i < MAX_LISTEN_SOCKETS; i++) {
for(i = 0; i < global.server_sockets; i++) {
if(global.serversock[i] == con->serversock) {
serverhost = config->listeners[i].bind_address;
serverport = config->listeners[i].port;
......
......@@ -302,6 +302,11 @@ static void *fserv_thread_function(void *arg)
{
fserve_t *to_go = (fserve_t *)pending_list;
pending_list = to_go->next;
/* Argh! _free_client decrements "clients" in stats, but it hasn't been
incremented if the client is still on the pending list. So, fix that
up first. Messy. */
stats_event_inc(NULL, "clients");
_free_client (to_go);
}
thread_mutex_unlock (&pending_lock);
......
......@@ -219,6 +219,9 @@ void source_clear_source (source_t *source)
avl_tree_rlock (source->pending_tree);
while (avl_get_first (source->pending_tree))
{
/* _free_client decrements client count, so increment it first... */
stats_event_inc(NULL, "clients");
avl_delete (source->pending_tree,
avl_get_first(source->pending_tree)->key, _free_client);
}
......@@ -689,6 +692,10 @@ void source_main (source_t *source)
/** add pending clients **/
client_node = avl_get_first(source->pending_tree);
while (client_node) {
/* We have to do this first, since _free_client decrements it... */
stats_event_inc(NULL, "clients");
if(source->max_listeners != -1 &&
source->listeners >= source->max_listeners)
{
......@@ -711,7 +718,6 @@ void source_main (source_t *source)
source->listeners++;
DEBUG0("Client added");
stats_event_inc(NULL, "clients");
stats_event_inc(source->mount, "connections");
client_node = avl_get_next(client_node);
......
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