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

karl at svn.xiph.org karl at svn.xiph.org
Mon Aug 29 17:30:32 PDT 2005


Author: karl
Date: 2005-08-29 17:30:30 -0700 (Mon, 29 Aug 2005)
New Revision: 9862

Modified:
   icecast/trunk/icecast/src/yp.c
Log:
extra checks on YP updating, typically on changes over HUP


Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c	2005-08-29 22:15:55 UTC (rev 9861)
+++ icecast/trunk/icecast/src/yp.c	2005-08-30 00:30:30 UTC (rev 9862)
@@ -601,7 +601,7 @@
             ypdata_t *yp;
 
             source_t *source = node->key;
-            if ((yp = create_yp_entry (source->mount)) != NULL)
+            if (source->yp_public && (yp = create_yp_entry (source->mount)) != NULL)
             {
                 DEBUG1 ("Adding existing mount %s", source->mount);
                 yp->server = server;
@@ -830,17 +830,26 @@
     while (server)
     {
         ypdata_t *yp;
-        /* add new ypdata to each servers pending yp */
-        if ((yp = create_yp_entry (mount)) != NULL)
+
+        /* on-demand relays may already have a YP entry */
+        yp = find_yp_mount (server->mounts, mount);
+        if (yp == NULL)
         {
-            DEBUG2 ("Adding %s to %s", mount, server->url);
-            yp->server = server;
-            yp->touch_interval = server->touch_interval;
-            yp->next = server->pending_mounts;
-            yp->next_update = time(NULL) + 5;
-            server->pending_mounts = yp;
-            yp_update = 1;
+            /* add new ypdata to each servers pending yp */
+            yp = create_yp_entry (mount);
+            if (yp)
+            {
+                DEBUG2 ("Adding %s to %s", mount, server->url);
+                yp->server = server;
+                yp->touch_interval = server->touch_interval;
+                yp->next = server->pending_mounts;
+                yp->next_update = time(NULL) + 5;
+                server->pending_mounts = yp;
+                yp_update = 1;
+            }
         }
+        else
+            DEBUG1 ("YP entry %s already exists", mount);
         server = server->next;
     }
     thread_mutex_unlock (&yp_pending_lock);



More information about the commits mailing list