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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Mon Aug 23 17:02:40 PDT 2004


Author: karl
Date: 2004-08-23 17:02:40 -0700 (Mon, 23 Aug 2004)
New Revision: 7620

Modified:
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/stats.c
   icecast/branches/kh/icecast/src/stats.h
Log:
make inactive on-demand relays show up on xsl pages


Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2004-08-23 20:16:57 UTC (rev 7619)
+++ icecast/branches/kh/icecast/src/source.c	2004-08-24 00:02:40 UTC (rev 7620)
@@ -77,6 +77,10 @@
 
     do
     {
+        unsigned int listen_url_size;
+        char *listenurl;
+        ice_config_t *config;
+
         avl_tree_wlock (global.source_tree);
         src = source_find_mount_raw (mount);
         if (src)
@@ -99,6 +103,25 @@
 
         avl_insert (global.source_tree, src);
 
+        config = config_get_config();
+
+        /* 6 for max size of port */
+        listen_url_size = strlen("http://") + strlen(config->hostname) +
+            strlen(":") + 6 + strlen(mount) + 1;
+
+        listenurl = malloc (listen_url_size);
+        if (listenurl)
+        {
+            snprintf (listenurl, listen_url_size, "http://%s:%d%s",
+                    config->hostname, config->port, mount);
+
+            stats_event (mount, "listenurl", listenurl);
+
+            free(listenurl);
+        }
+        config_release_config();
+        stats_event (mount, "listeners", "0");
+
     } while (0);
 
     avl_tree_unlock (global.source_tree);
@@ -284,6 +307,8 @@
     avl_tree_wlock (global.source_tree);
     avl_delete (global.source_tree, source, NULL);
     avl_tree_unlock (global.source_tree);
+    stats_event (source->mount, "listeners", NULL);
+    stats_event (source->mount, NULL, NULL);
 
     /* There should be no listeners on this mount */
     if (source->active_clients)
@@ -651,28 +676,8 @@
 
 static void source_init (source_t *source)
 {
-    ice_config_t *config = config_get_config();
-    char *listenurl, *str = NULL;
-    int listen_url_size;
+    char *str = NULL;
 
-    /* 6 for max size of port */
-    listen_url_size = strlen("http://") + strlen(config->hostname) +
-        strlen(":") + 6 + strlen(source->mount) + 1;
-
-    listenurl = malloc (listen_url_size);
-    if (listenurl)
-    {
-        snprintf (listenurl, listen_url_size, "http://%s:%d%s",
-                config->hostname, config->port, source->mount);
-        config_release_config();
-
-        stats_event (source->mount, "listenurl", listenurl);
-
-        free(listenurl);
-    }
-    else
-        config_release_config();
-
     thread_mutex_lock (&source->lock);
     if (source->yp_prevent == 0)
     {
@@ -728,7 +733,6 @@
     source->listeners = 0;
     stats_event_inc (NULL, "sources");
     stats_event_inc (NULL, "source_total_connections");
-    stats_event (source->mount, "listeners", "0");
     stats_event (source->mount, "type", source->format->format_description);
 
     sock_set_blocking (source->con->sock, SOCK_NONBLOCK);
@@ -1091,7 +1095,6 @@
 
     /* delete this sources stats */
     stats_event_dec (NULL, "sources");
-    stats_event (source->mount, "listeners", NULL);
 
     /* we don't remove the source from the tree here, it may be a relay and
        therefore reserved */

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2004-08-23 20:16:57 UTC (rev 7619)
+++ icecast/branches/kh/icecast/src/stats.c	2004-08-24 00:02:40 UTC (rev 7620)
@@ -155,7 +155,7 @@
     return NULL;
 }
 
-void stats_event(char *source, char *name, char *value)
+void stats_event(const char *source, char *name, char *value)
 {
     stats_event_t *node;
     stats_event_t *event;
@@ -183,7 +183,7 @@
     thread_mutex_unlock(&_global_event_mutex);
 }
 
-void stats_event_args(char *source, char *name, char *format, ...)
+void stats_event_args(const char *source, char *name, char *format, ...)
 {
     char buf[1024];
     va_list val;

Modified: icecast/branches/kh/icecast/src/stats.h
===================================================================
--- icecast/branches/kh/icecast/src/stats.h	2004-08-23 20:16:57 UTC (rev 7619)
+++ icecast/branches/kh/icecast/src/stats.h	2004-08-24 00:02:40 UTC (rev 7620)
@@ -77,8 +77,8 @@
 
 stats_t *stats_get_stats();
 
-void stats_event(char *source, char *name, char *value);
-void stats_event_args(char *source, char *name, char *format, ...);
+void stats_event(const char *source, char *name, char *value);
+void stats_event_args(const char *source, char *name, char *format, ...);
 void stats_event_inc(char *source, char *name);
 void stats_event_add(char *source, char *name, unsigned long value);
 void stats_event_dec(char *source, char *name);



More information about the commits mailing list