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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Thu Oct 21 04:33:36 PDT 2004


Author: karl
Date: 2004-10-21 04:33:36 -0700 (Thu, 21 Oct 2004)
New Revision: 8064

Modified:
   icecast/branches/kh/icecast/src/slave.c
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/yp.c
Log:
for on-demand relays, don't remove YP entries if inactive, keep refreshing
them but also avoid creating duplicates in yp_add


Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c	2004-10-21 07:35:15 UTC (rev 8063)
+++ icecast/branches/kh/icecast/src/slave.c	2004-10-21 11:33:36 UTC (rev 8064)
@@ -295,6 +295,8 @@
 
         if (relay->on_demand == 0)
         {
+            /* only keep refreshing YP entries for inactive on-demand relays */
+            yp_remove (relay->localmount);
             source_recheck_mounts();
         }
         /* initiate an immediate relay cleanup run */

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2004-10-21 07:35:15 UTC (rev 8063)
+++ icecast/branches/kh/icecast/src/source.c	2004-10-21 11:33:36 UTC (rev 8064)
@@ -285,6 +285,9 @@
     free(source->fallback_mount);
     source->fallback_mount = NULL;
 
+    /* make sure all YP entries have gone */
+    yp_remove (source->mount);
+
     /* There should be no listeners on this mount */
     if (source->active_clients)
         WARN1("active listeners on mountpoint %s", source->mount);
@@ -1046,8 +1049,6 @@
     INFO1("Source \"%s\" exiting", source->mount);
     source->running = 0;
 
-    yp_remove (source->mount);
-
     if (source->on_disconnect)
         source_run_script (source->on_disconnect, source->mount);
 

Modified: icecast/branches/kh/icecast/src/yp.c
===================================================================
--- icecast/branches/kh/icecast/src/yp.c	2004-10-21 07:35:15 UTC (rev 8063)
+++ icecast/branches/kh/icecast/src/yp.c	2004-10-21 11:33:36 UTC (rev 8064)
@@ -844,16 +844,26 @@
     while (server)
     {
         ypdata_t *yp;
-        /* add new ypdata to each servers pending yp */
-        if ((yp = create_yp_entry (source)) != NULL)
+
+        /* check if YP entry is known about, as source_t is unique this
+         * should only apply to the restarting of on-demand relays */
+        yp = find_yp_mount (server->mounts, source->mount);
+        if (yp == NULL)
         {
-            DEBUG2 ("Adding %s to %s", source->mount, server->url);
-            yp->server = server;
-            yp->touch_interval = server->touch_interval;
-            yp->next = server->pending_mounts;
-            server->pending_mounts = yp;
-            yp_update = 1;
+            /* add new ypdata to each servers pending yp */
+            yp = create_yp_entry (source);
+            if (yp)
+            {
+                DEBUG2 ("Adding %s to %s", source->mount, server->url);
+                yp->server = server;
+                yp->touch_interval = server->touch_interval;
+                yp->next = server->pending_mounts;
+                server->pending_mounts = yp;
+                yp_update = 1;
+            }
         }
+        else
+            DEBUG1 ("YP entry %s already exists", source->mount);
         server = server->next;
     }
     thread_mutex_unlock (&yp_pending_lock);



More information about the commits mailing list