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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Fri Oct 8 09:16:43 PDT 2004


Author: karl
Date: 2004-10-08 09:16:43 -0700 (Fri, 08 Oct 2004)
New Revision: 7936

Modified:
   icecast/branches/kh/icecast/src/slave.c
Log:
only update settings/stats if a relay is freed, not each time through the loop


Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c	2004-10-08 15:40:37 UTC (rev 7935)
+++ icecast/branches/kh/icecast/src/slave.c	2004-10-08 16:16:43 UTC (rev 7936)
@@ -64,6 +64,7 @@
 
 static thread_type *_slave_thread_id;
 static int slave_running = 0;
+static int update_settings = 0;
 static volatile unsigned int max_interval = 0;
 static volatile int rescan_relays = 0;
 static rwlock_t slaves_lock;
@@ -373,12 +374,11 @@
             break;
         if (relay->on_demand)
         {
-            DEBUG0 ("check fallback on-demand relay");
             if (source->fallback_mount && source->fallback_override)
             {
                 source_t *fallback;
+                DEBUG2 ("checking %s for fallback override", source->fallback_mount);
                 avl_tree_rlock (global.source_tree);
-                DEBUG2 ("checking %s override %d", source->fallback_mount, source->fallback_override);
                 fallback = source_find_mount (source->fallback_mount);
                 if (fallback && fallback->running && fallback->listeners)
                 {
@@ -490,6 +490,7 @@
         }
         /* relay is going, drop its stats */
         stats_event (to_free->localmount, NULL, NULL);
+        update_settings = 1;
         to_free = relay_free (to_free);
     }
 
@@ -685,7 +686,11 @@
             thread_mutex_unlock (&(config_locks()->relay_lock));
         }
         rescan_relays = 0;
-        source_recheck_mounts();
+        if (update_settings)
+        {
+            update_settings = 0;
+            source_recheck_mounts();
+        }
     }
     DEBUG0 ("shutting down current relays");
     relay_check_streams (NULL, global.relays);



More information about the commits mailing list