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

karl at svn.xiph.org karl at svn.xiph.org
Fri Aug 10 06:04:40 PDT 2007


Author: karl
Date: 2007-08-10 06:04:40 -0700 (Fri, 10 Aug 2007)
New Revision: 13503

Modified:
   icecast/trunk/icecast/src/auth.c
   icecast/trunk/icecast/src/format.c
Log:
fix possible segv case, and only increase certain listener stats when stream is
active (on demand relays may not actually start when triggered)


Modified: icecast/trunk/icecast/src/auth.c
===================================================================
--- icecast/trunk/icecast/src/auth.c	2007-08-09 23:52:58 UTC (rev 13502)
+++ icecast/trunk/icecast/src/auth.c	2007-08-10 13:04:40 UTC (rev 13503)
@@ -311,7 +311,6 @@
     avl_tree_wlock (source->pending_tree);
     avl_insert (source->pending_tree, client);
     avl_tree_unlock (source->pending_tree);
-    stats_event_inc (NULL, "listener_connections");
 
     if (source->running == 0 && source->on_demand)
     {

Modified: icecast/trunk/icecast/src/format.c
===================================================================
--- icecast/trunk/icecast/src/format.c	2007-08-09 23:52:58 UTC (rev 13502)
+++ icecast/trunk/icecast/src/format.c	2007-08-10 13:04:40 UTC (rev 13503)
@@ -93,7 +93,7 @@
 {
     refbuf_t *refbuf = source->burst_point;
 
-    /* we only want to attempt a burst at connection time, not midstream 
+    /* we only want to attempt a burst at connection time, not midstream
      * however streams like theora may not have the most recent page marked as
      * a starting point, so look for one from the burst point */
     if (client->intro_offset == -1 && source->stream_data_tail
@@ -101,10 +101,9 @@
         refbuf = source->stream_data_tail;
     else
     {
-        long size = 0;
+        size_t size = client->intro_offset;
         refbuf = source->burst_point;
-        size = client->intro_offset;
-        while (size > 0 && refbuf->next)
+        while (size > 0 && refbuf && refbuf->next)
         {
             size -= refbuf->len;
             refbuf = refbuf->next;
@@ -129,7 +128,7 @@
 static int get_file_data (FILE *intro, client_t *client)
 {
     refbuf_t *refbuf = client->refbuf;
-    int bytes;
+    size_t bytes;
 
     if (intro == NULL || fseek (intro, client->intro_offset, SEEK_SET) < 0)
         return 0;
@@ -209,6 +208,8 @@
             client->con->error = 1;
             return -1;
         }
+        stats_event_inc (NULL, "listener_connections");
+        stats_event_inc (source->mount, "listener_connections");
     }
 
     if (client->pos == refbuf->len)



More information about the commits mailing list