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

karl at svn.xiph.org karl at svn.xiph.org
Tue Apr 22 18:45:39 PDT 2008


Author: karl
Date: 2008-04-22 18:45:38 -0700 (Tue, 22 Apr 2008)
New Revision: 14787

Modified:
   icecast/trunk/icecast/src/source.c
   icecast/trunk/icecast/src/yp.c
Log:
YP fixup for unusual cases. Inactive on-demand relays were not sending certain
details to stats engine.  On YP remove, make sure we find all nodes for that
montpoint not just the first. Allow at least 20mins from a failed touch before
next add, allows YP to give a longer wait period for misconfigured setups by
issuing a TouchFreq header on rejection.


Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c	2008-04-23 00:32:20 UTC (rev 14786)
+++ icecast/trunk/icecast/src/source.c	2008-04-23 01:45:38 UTC (rev 14787)
@@ -989,7 +989,7 @@
 
     /* stream name */
     if (mountinfo && mountinfo->stream_name)
-        str = mountinfo->stream_name;
+        stats_event (source->mount, "server_name", mountinfo->stream_name);
     else
     {
         do {
@@ -1001,13 +1001,13 @@
             if (str) break;
             str = "Unspecified name";
         } while (0);
+        if (source->format)
+            stats_event_conv (source->mount, "server_name", str, source->format->charset);
     }
-    if (str && source->format)
-        stats_event_conv (source->mount, "server_name", str, source->format->charset);
 
     /* stream description */
     if (mountinfo && mountinfo->stream_description)
-        str = mountinfo->stream_description;
+        stats_event (source->mount, "server_description", mountinfo->stream_description);
     else
     {
         do {
@@ -1019,13 +1019,13 @@
             if (str) break;
             str = "Unspecified description";
         } while (0);
+        if (source->format)
+            stats_event_conv (source->mount, "server_description", str, source->format->charset);
     }
-    if (str && source->format)
-        stats_event_conv (source->mount, "server_description", str, source->format->charset);
 
     /* stream URL */
     if (mountinfo && mountinfo->stream_url)
-        str = mountinfo->stream_url;
+        stats_event (source->mount, "server_url", mountinfo->stream_url);
     else
     {
         do {
@@ -1036,13 +1036,13 @@
             str = httpp_getvar (parser, "x-audiocast-url");
             if (str) break;
         } while (0);
+        if (str && source->format)
+            stats_event_conv (source->mount, "server_url", str, source->format->charset);
     }
-    if (str && source->format)
-        stats_event_conv (source->mount, "server_url", str, source->format->charset);
 
     /* stream genre */
     if (mountinfo && mountinfo->stream_genre)
-        str = mountinfo->stream_genre;
+        stats_event (source->mount, "genre", mountinfo->stream_genre);
     else
     {
         do {
@@ -1054,9 +1054,9 @@
             if (str) break;
             str = "various";
         } while (0);
+        if (source->format)
+            stats_event_conv (source->mount, "genre", str, source->format->charset);
     }
-    if (str && source->format)
-        stats_event_conv (source->mount, "genre", str, source->format->charset);
 
     /* stream bitrate */
     if (mountinfo && mountinfo->bitrate)

Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c	2008-04-23 00:32:20 UTC (rev 14786)
+++ icecast/trunk/icecast/src/yp.c	2008-04-23 01:45:38 UTC (rev 14787)
@@ -316,10 +316,19 @@
             ERROR3 ("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
             yp->next_update += 7200;
         }
-        else
+        if (yp->process == do_yp_touch)
         {
+            /* At this point the touch request failed, either because they rejected our session
+             * or the server isn't accessible. This means we have to wait before doing another
+             * add request. We have a minimum delay but we could allow the directory server to
+             * give us a wait time using the TouchFreq header. This time could be given in such
+             * cases as a firewall block or incorrect listenurl.
+             */
+            if (yp->touch_interval < 1200)
+                yp->next_update += 1200;
+            else
+                yp->next_update += yp->touch_interval;
             INFO3 ("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
-            yp->next_update += 1200;
         }
         yp->process = do_yp_add;
         free (yp->sid);
@@ -904,9 +913,18 @@
     thread_rwlock_rlock (&yp_lock);
     while (server)
     {
-        ypdata_t *yp = find_yp_mount (server->mounts, mount);
-        if (yp)
+        ypdata_t *list = server->mounts;
+
+        while (1)
         {
+            ypdata_t *yp = find_yp_mount (list, mount);
+            if (yp == NULL)
+                break;
+            if (yp->release || yp->remove)
+            {
+                list = yp->next;
+                continue;   /* search again these are old entries */
+            }
             DEBUG2 ("release %s on YP %s", mount, server->url);
             yp->release = 1;
             yp->next_update = 0;



More information about the commits mailing list