[xiph-commits] r9833 - in icecast/trunk/icecast: conf doc src

karl at svn.xiph.org karl at svn.xiph.org
Tue Aug 23 11:40:25 PDT 2005


Author: karl
Date: 2005-08-23 11:40:20 -0700 (Tue, 23 Aug 2005)
New Revision: 9833

Modified:
   icecast/trunk/icecast/conf/icecast.xml.in
   icecast/trunk/icecast/doc/icecast2_config_file.html
   icecast/trunk/icecast/src/auth.c
   icecast/trunk/icecast/src/cfgfile.c
   icecast/trunk/icecast/src/cfgfile.h
   icecast/trunk/icecast/src/source.c
   icecast/trunk/icecast/src/source.h
Log:
Allow for new listeners to fallback if there are max listeners on the
current mountpoint


Modified: icecast/trunk/icecast/conf/icecast.xml.in
===================================================================
--- icecast/trunk/icecast/conf/icecast.xml.in	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/conf/icecast.xml.in	2005-08-23 18:40:20 UTC (rev 9833)
@@ -98,6 +98,7 @@
         <burst-size>65536</burst-size>
         <fallback-mount>/example2.ogg</fallback-mount>
         <fallback-override>1</fallback-override>
+        <fallback-when-full>1</fallback-when-full>
         <intro>/example_intro.ogg</intro>
         <hidden>1</hidden>
         <no-yp>1</no-yp>

Modified: icecast/trunk/icecast/doc/icecast2_config_file.html
===================================================================
--- icecast/trunk/icecast/doc/icecast2_config_file.html	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/doc/icecast2_config_file.html	2005-08-23 18:40:20 UTC (rev 9833)
@@ -369,6 +369,7 @@
         &lt;intro&gt;/intro.ogg&lt;/intro&gt;
         &lt;fallback-mount&gt;/example2.ogg&lt;/fallback-mount&gt;
         &lt;fallback-override&gt;1&lt;/fallback-override&gt;
+        &lt;fallback-when-full&gt;1&lt;/fallback-when-full&gt;
         &lt;public&gt;1&lt;/public&gt;
         &lt;stream-name&gt;My audio stream&lt;/stream-name&gt;
         &lt;stream-description&gt;My audio description&lt;/stream-description&gt;
@@ -455,6 +456,12 @@
 When enabled, this allows a connecting source client or relay on this mountpoint to move
 listening clients back from the fallback mount.
 </div>
+<h4>fallback-when-full</h4>
+<div class="indentedbox">
+    <p>When set to 1, this will cause new listeners, when the max listener count for the
+    mountpoint has been reached, to move to the fallback mount if there is one specified.
+    </p>
+</div>
 <h4>no-yp (deprecated)</h4>
 <div class="indentedbox">
     <p>Setting this option prevents this mountpoint from advertising on YP.  The default is 0

Modified: icecast/trunk/icecast/src/auth.c
===================================================================
--- icecast/trunk/icecast/src/auth.c	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/src/auth.c	2005-08-23 18:40:20 UTC (rev 9833)
@@ -259,6 +259,7 @@
  */
 static int add_client_to_source (source_t *source, client_t *client)
 {
+    int loop = 10;
     do
     {
         DEBUG3 ("max on %s is %ld (cur %lu)", source->mount,
@@ -268,6 +269,14 @@
         if (source->listeners < (unsigned long)source->max_listeners)
             break;
 
+        if (loop && source->fallback_when_full && source->fallback_mount)
+        {
+            source_t *next = source_find_mount (source->fallback_mount);
+            INFO1 ("stream full trying %s", next->mount);
+            source = next;
+            loop--;
+            continue;
+        }
         /* now we fail the client */
         return -1;
 

Modified: icecast/trunk/icecast/src/cfgfile.c
===================================================================
--- icecast/trunk/icecast/src/cfgfile.c	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/src/cfgfile.c	2005-08-23 18:40:20 UTC (rev 9833)
@@ -569,6 +569,11 @@
             mount->fallback_mount = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
+        else if (strcmp(node->name, "fallback-when-full") == 0) {
+            tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+            mount->fallback_when_full = atoi(tmp);
+            if(tmp) xmlFree(tmp);
+        }
         else if (strcmp(node->name, "max-listeners") == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->max_listeners = atoi(tmp);

Modified: icecast/trunk/icecast/src/cfgfile.h
===================================================================
--- icecast/trunk/icecast/src/cfgfile.h	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/src/cfgfile.h	2005-08-23 18:40:20 UTC (rev 9833)
@@ -49,6 +49,8 @@
     char *dumpfile; /* Filename to dump this stream to (will be appended). NULL
                        to not dump. */
     char *intro_filename;   /* Send contents of file to client before the stream */
+    int fallback_when_full; /* switch new listener to fallback source
+                               when max listeners reached */
     int max_listeners; /* Max listeners for this mountpoint only. -1 to not 
                           limit here (i.e. only use the global limit) */
     char *fallback_mount; /* Fallback mountname */

Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/src/source.c	2005-08-23 18:40:20 UTC (rev 9833)
@@ -1118,6 +1118,9 @@
     if (mountinfo && mountinfo->burst_size >= 0)
         source->burst_size = (unsigned int)mountinfo->burst_size;
 
+    if (mountinfo && mountinfo->fallback_when_full)
+        source->fallback_when_full = mountinfo->fallback_when_full;
+
     if (source->format && source->format->apply_settings)
         source->format->apply_settings (source->client, source->format, mountinfo);
 }

Modified: icecast/trunk/icecast/src/source.h
===================================================================
--- icecast/trunk/icecast/src/source.h	2005-08-23 10:48:09 UTC (rev 9832)
+++ icecast/trunk/icecast/src/source.h	2005-08-23 18:40:20 UTC (rev 9833)
@@ -54,6 +54,7 @@
     long max_listeners;
     int yp_public;
     int fallback_override;
+    int fallback_when_full;
     int shoutcast_compat;
 
     /* per source burst handling for connecting clients */



More information about the commits mailing list