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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Wed Nov 17 03:38:55 PST 2004


Author: karl
Date: 2004-11-17 03:38:54 -0800 (Wed, 17 Nov 2004)
New Revision: 8211

Modified:
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/yp.c
Log:
add 2 extra stats, and send a max listener setting to YP 


Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2004-11-17 04:14:32 UTC (rev 8210)
+++ icecast/branches/kh/icecast/src/connection.c	2004-11-17 11:38:54 UTC (rev 8211)
@@ -334,6 +334,7 @@
 
     config = config_get_config();
     threadpool_size = config->threadpool_size;
+    source_update (config);
     config_release_config();
 
     for (i = 0; i < threadpool_size; i++) {

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2004-11-17 04:14:32 UTC (rev 8210)
+++ icecast/branches/kh/icecast/src/source.c	2004-11-17 11:38:54 UTC (rev 8211)
@@ -1327,7 +1327,13 @@
 void source_update (ice_config_t *config)
 {
     avl_node *node;
+    char limit [20];
 
+    snprintf (limit, sizeof (limit), "%d", config->client_limit);
+    stats_event (NULL, "client_limit", limit);
+    snprintf (limit, sizeof (limit), "%d", config->source_limit);
+    stats_event (NULL, "source_limit", limit);
+
     avl_tree_rlock (global.source_tree);
     node = avl_get_first (global.source_tree);
     while (node)

Modified: icecast/branches/kh/icecast/src/yp.c
===================================================================
--- icecast/branches/kh/icecast/src/yp.c	2004-11-17 04:14:32 UTC (rev 8210)
+++ icecast/branches/kh/icecast/src/yp.c	2004-11-17 11:38:54 UTC (rev 8211)
@@ -364,6 +364,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");
@@ -394,9 +395,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*/
 



More information about the commits mailing list