[xiph-commits] r9074 - icecast/trunk/icecast/src

msmith at motherfish-iii.xiph.org msmith at motherfish-iii.xiph.org
Mon Mar 14 15:07:43 PST 2005


Author: msmith
Date: 2005-03-14 15:07:34 -0800 (Mon, 14 Mar 2005)
New Revision: 9074

Modified:
   icecast/trunk/icecast/src/connection.c
   icecast/trunk/icecast/src/fserve.c
   icecast/trunk/icecast/src/source.c
Log:
Fix various places where "clients" stats value was decremented without having
previously been incremented. 


Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c	2005-03-14 05:01:00 UTC (rev 9073)
+++ icecast/trunk/icecast/src/connection.c	2005-03-14 23:07:34 UTC (rev 9074)
@@ -694,7 +694,7 @@
     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 @@
              * 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 @@
     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;

Modified: icecast/trunk/icecast/src/fserve.c
===================================================================
--- icecast/trunk/icecast/src/fserve.c	2005-03-14 05:01:00 UTC (rev 9073)
+++ icecast/trunk/icecast/src/fserve.c	2005-03-14 23:07:34 UTC (rev 9074)
@@ -302,6 +302,11 @@
     {
         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);

Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c	2005-03-14 05:01:00 UTC (rev 9073)
+++ icecast/trunk/icecast/src/source.c	2005-03-14 23:07:34 UTC (rev 9074)
@@ -219,6 +219,9 @@
     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 @@
         /** 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 @@
 
             source->listeners++;
             DEBUG0("Client added");
-            stats_event_inc(NULL, "clients");
             stats_event_inc(source->mount, "connections");
 
             client_node = avl_get_next(client_node);



More information about the commits mailing list