[xiph-commits] r7931 - icecast/branches/kh/icecast/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Thu Oct 7 16:54:26 PDT 2004


Author: karl
Date: 2004-10-07 16:54:26 -0700 (Thu, 07 Oct 2004)
New Revision: 7931

Modified:
   icecast/branches/kh/icecast/src/slave.c
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/stats.c
Log:
stats changes for xsl presentation, mainly related to fallback handling.
Fixed problem where an on-demand relay as a fallback kicked off when it
shouldn't


Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c	2004-10-07 22:22:18 UTC (rev 7930)
+++ icecast/branches/kh/icecast/src/slave.c	2004-10-07 23:54:26 UTC (rev 7931)
@@ -475,6 +475,8 @@
             to_free->source->running = 0;
             thread_join (to_free->thread);
         }
+        /* relay is going, drop its stats */
+        stats_event (to_free->localmount, NULL, NULL);
         to_free = relay_free (to_free);
     }
 
@@ -670,6 +672,7 @@
             thread_mutex_unlock (&(config_locks()->relay_lock));
         }
         rescan_relays = 0;
+        source_recheck_mounts();
     }
     DEBUG0 ("shutting down current relays");
     relay_check_streams (NULL, global.relays);

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2004-10-07 22:22:18 UTC (rev 7930)
+++ icecast/branches/kh/icecast/src/source.c	2004-10-07 23:54:26 UTC (rev 7931)
@@ -282,7 +282,6 @@
     avl_delete (global.source_tree, source, NULL);
     avl_tree_unlock (global.source_tree);
 
-    stats_event (source->mount, NULL, NULL);
     free(source->fallback_mount);
     source->fallback_mount = NULL;
 
@@ -329,6 +328,7 @@
  */
 void source_move_clients (source_t *source, source_t *dest)
 {
+    unsigned int count = 0;
     /* we don't want the two write locks to deadlock in here */
     thread_mutex_lock (&move_clients_mutex);
     thread_mutex_lock (&dest->lock);
@@ -344,7 +344,6 @@
 
     do
     {
-        long count = 0;
         thread_mutex_lock (&source->lock);
 
         if (source->on_demand == 0 && source->format == NULL)
@@ -387,10 +386,10 @@
         if (count != source->new_listeners)
             WARN2 ("count %u, new listeners %u", count, source->new_listeners);
         
-        INFO2 ("passing %d listeners to \"%s\"",
-                source->listeners + source->new_listeners, dest->mount);
+        count = source->listeners + source->new_listeners;
+        INFO2 ("passing %d listeners to \"%s\"", count, dest->mount);
 
-        dest->new_listeners += source->listeners + source->new_listeners;
+        dest->new_listeners += count;
         dest->check_pending = 1;
         source->listeners = 0;
         source->new_listeners = 0;
@@ -400,7 +399,7 @@
 
     thread_mutex_unlock (&source->lock);
     /* see if we need to wake up an on-demand relay */
-    if (dest->running == 0 && dest->on_demand)
+    if (dest->running == 0 && dest->on_demand && count)
     {
         dest->on_demand_req = 1;
         slave_rescan();
@@ -1320,6 +1319,7 @@
         global.sources--;
         global_unlock();
         WARN0 ("Error writing 200 OK message to source client");
+        source_free_source (source);
     }
     else
     {
@@ -1328,9 +1328,9 @@
         stats_event_inc(NULL, "source_client_connections");
         stats_event (source->mount, "listeners", "0");
         source_main (source);
+        source_free_source (source);
         source_recheck_mounts();
     }
-    source_free_source (source);
     return NULL;
 }
 

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2004-10-07 22:22:18 UTC (rev 7930)
+++ icecast/branches/kh/icecast/src/stats.c	2004-10-07 23:54:26 UTC (rev 7931)
@@ -533,6 +533,8 @@
     stats_event_t *copy;
     event_listener_t *listener;
 
+    stats_event (NULL, "server", ICECAST_VERSION_STRING);
+
     /* global currently active stats */
     stats_event (NULL, "clients", "0");
     stats_event (NULL, "connections", "0");



More information about the commits mailing list