[xiph-commits] r9436 - in icecast/branches/kh/icecast: doc src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Fri Jun 10 12:41:04 PDT 2005


Author: karl
Date: 2005-06-10 12:40:57 -0700 (Fri, 10 Jun 2005)
New Revision: 9436

Modified:
   icecast/branches/kh/icecast/doc/icecast2_config_file.html
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/stats.c
   icecast/branches/kh/icecast/src/stats.h
Log:
small stats cleanup, resync docs


Modified: icecast/branches/kh/icecast/doc/icecast2_config_file.html
===================================================================
--- icecast/branches/kh/icecast/doc/icecast2_config_file.html	2005-06-10 18:01:53 UTC (rev 9435)
+++ icecast/branches/kh/icecast/doc/icecast2_config_file.html	2005-06-10 19:40:57 UTC (rev 9436)
@@ -450,7 +450,18 @@
 mountpoint that is just not available, then those clients will be disconnected.
 If clients are falling back to a mountpoint and the fallback-mount is not actively streaming
 but defines a fallback-mount itself then those clients may be moved there instead.
-This multi-level fallback allows clients to cascade several mountpoints.
+This multi-level fallback allows clients to cascade several mountpoints. 
+    <p>A fallback mount can also state a file that is located in webroot.  This is useful for
+    playing a pre-recorded file in the case of a stream going down. It will repeat until either
+    the listener disconnects or a stream comes back available and takes the listeners back.
+    As per usual, the file format should match the stream format, failing to do so may cause
+    problems with playback.
+    </p>
+    <p>Note that the fallback file is not timed so be careful if you intend to relay this.
+    They are fine on slave streams but don't use them on master streams, if you do then the
+    relay will consume stream data at a faster rate and the listeners on the relay would
+    eventually get kicked off.
+    </p>
 </div>
 <h4>fallback-override</h4>
 <div class="indentedbox">

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-06-10 18:01:53 UTC (rev 9435)
+++ icecast/branches/kh/icecast/src/connection.c	2005-06-10 19:40:57 UTC (rev 9436)
@@ -482,6 +482,7 @@
         }
 
         global.sources++;
+        stats_event_args (NULL, "sources", "%d", global.sources);
         global_unlock();
 
         /* for relays, we don't yet have a client, however we do require one

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2005-06-10 18:01:53 UTC (rev 9435)
+++ icecast/branches/kh/icecast/src/source.c	2005-06-10 19:40:57 UTC (rev 9436)
@@ -640,14 +640,13 @@
 static void source_init (source_t *source)
 {
     char *str = "0";
-    char buffer [100];
-    struct tm local;
     mount_proxy *mountinfo;
 
     thread_mutex_lock (&source->lock);
 
     stats_event (source->mount, "server_type", source->format->contenttype);
     stats_event_args (source->mount, "listener_peak", "0");
+    stats_event_time (source->mount, "stream_start");
 
     if (source->dumpfilename != NULL)
     {
@@ -663,7 +662,6 @@
     thread_rwlock_rlock (source->shutdown_rwlock);
 
     /* start off the statistics */
-    stats_event_inc (NULL, "sources");
     stats_event_inc (NULL, "source_total_connections");
     stats_event (source->mount, "slow_listeners", "0");
 
@@ -687,10 +685,6 @@
 
     thread_mutex_unlock (&source->lock);
 
-    localtime_r (&global.time, &local);
-    strftime (buffer, sizeof (buffer), "%a, %d %b %Y %H:%M:%S %z", &local);
-    stats_event (source->mount, "stream_start", buffer);
-
     mountinfo = config_find_mount (config_get_config(), source->mount);
     if (mountinfo && mountinfo->on_connect)
         source_run_script (mountinfo->on_connect, source->mount);
@@ -804,7 +798,6 @@
     }
 
     /* delete this sources stats */
-    stats_event_dec (NULL, "sources");
     stats_event(source->mount, NULL, NULL);
 
     /* we don't remove the source from the tree here, it may be a relay and
@@ -815,6 +808,7 @@
 
     global_lock();
     global.sources--;
+    stats_event_args (NULL, "sources", "%d", global.sources);
     global_unlock();
 
     /* release our hold on the lock so the main thread can continue cleaning up */
@@ -1152,7 +1146,6 @@
         snprintf (buf, sizeof (buf), "%ld", source->max_listeners);
         stats_event (source->mount, "max_listeners", buf);
     }
-
     DEBUG1 ("public set to %d", source->yp_public);
     DEBUG1 ("max listeners to %ld", source->max_listeners);
     DEBUG1 ("queue size to %u", source->queue_size_limit);

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2005-06-10 18:01:53 UTC (rev 9435)
+++ icecast/branches/kh/icecast/src/stats.c	2005-06-10 19:40:57 UTC (rev 9436)
@@ -533,19 +533,26 @@
 }
 
 
+void stats_event_time (const char *mount, const char *name)
+{
+    time_t now = global.time;
+    struct tm local;
+    char buffer[100];
+
+    localtime_r (&now, &local);
+    strftime (buffer, sizeof (buffer), "%a, %d %b %Y %H:%M:%S %z", &local);
+    stats_event (mount, name, buffer);
+}
+
+
 static void *_stats_thread(void *arg)
 {
     stats_event_t *event;
     stats_event_t *copy;
     event_listener_t *listener;
-    time_t now = time (NULL);
-    struct tm local;
-    char buffer[100];
 
     stats_event (NULL, "server", ICECAST_VERSION_STRING);
-    localtime_r (&now, &local);
-    strftime (buffer, sizeof (buffer), "%a, %d %b %Y %H:%M:%S %z", &local);
-    stats_event (NULL, "server_start", buffer);
+    stats_event_time (NULL, "server_start");
 
     /* global currently active stats */
     stats_event (NULL, "clients", "0");

Modified: icecast/branches/kh/icecast/src/stats.h
===================================================================
--- icecast/branches/kh/icecast/src/stats.h	2005-06-10 18:01:53 UTC (rev 9435)
+++ icecast/branches/kh/icecast/src/stats.h	2005-06-10 19:40:57 UTC (rev 9436)
@@ -81,6 +81,7 @@
 void stats_event_add(const char *source, const char *name, unsigned long value);
 void stats_event_dec(const char *source, const char *name);
 void stats_event_hidden (const char *source, const char *name, int hidden);
+void stats_event_time (const char *mount, const char *name);
 
 void *stats_connection(void *arg);
 void *stats_callback(void *arg);



More information about the commits mailing list