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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Tue Dec 7 18:28:08 PST 2004


Author: karl
Date: 2004-12-07 18:28:07 -0800 (Tue, 07 Dec 2004)
New Revision: 8347

Modified:
   icecast/trunk/icecast/src/yp.c
Log:
provide max_listeners to YP, yp touch fixup and minor memory leak fixed


Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c	2004-12-07 22:42:50 UTC (rev 8346)
+++ icecast/trunk/icecast/src/yp.c	2004-12-08 02:28:07 UTC (rev 8347)
@@ -353,6 +353,7 @@
     unsigned listeners = 0;
     char *val, *artist, *title;
     int ret;
+    char *max_listeners;
 
     artist = (char *)stats_get_value (yp->mount, "artist");
     title = (char *)stats_get_value (yp->mount, "title");
@@ -383,9 +384,17 @@
         listeners = atoi (val);
         free (val);
     }
-    ret = snprintf (s, len, "action=touch&sid=%s&st=%s&listeners=%u\r\n", 
-            yp->sid, yp->current_song, listeners);
+    max_listeners = stats_get_value (yp->mount, "max_listeners");
+    if (max_listeners == NULL || strcmp (max_listeners, "unlimited") == 0)
+    {
+        free (max_listeners);
+        max_listeners = (char *)stats_get_value (NULL, "client_limit");
+    }
 
+    ret = snprintf (s, len, "action=touch&sid=%s&st=%s"
+            "&listeners=%u&max_listeners=%s\r\n",
+            yp->sid, yp->current_song, listeners, max_listeners);
+
     if (ret >= (signed)len)
         return ret+1; /* space required for above text and nul*/
 
@@ -738,6 +747,9 @@
         if (ypdata->audio_info) {
             free(ypdata->audio_info);
         }
+        if (ypdata->audio_info) {
+            free(ypdata->cluster_password);
+        }
         free (ypdata->error_msg);
         free (ypdata);
     }
@@ -913,7 +925,7 @@
         if (yp)
         {
             /* we may of found old entries not purged yet, so skip them */
-            if (yp->release == 0 || yp->remove == 0)
+            if (yp->release != 0 || yp->remove != 0)
             {
                 search_list = yp->next;
                 continue;



More information about the commits mailing list