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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Wed Apr 6 08:52:58 PDT 2005


Author: karl
Date: 2005-04-06 08:52:55 -0700 (Wed, 06 Apr 2005)
New Revision: 9114

Modified:
   icecast/branches/kh/icecast/src/cfgfile.c
   icecast/branches/kh/icecast/src/source.c
Log:
allow for a default mount named "all" which can be applied if no
specific mount name can be found for the request


Modified: icecast/branches/kh/icecast/src/cfgfile.c
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.c	2005-04-06 01:29:12 UTC (rev 9113)
+++ icecast/branches/kh/icecast/src/cfgfile.c	2005-04-06 15:52:55 UTC (rev 9114)
@@ -1002,14 +1002,18 @@
 
 mount_proxy *config_find_mount (ice_config_t *config, const char *mount)
 {
-    mount_proxy *mountinfo = config->mounts;
+    mount_proxy *mountinfo = config->mounts, *global = NULL;
 
     while (mountinfo)
     {
+        if (strcmp (mountinfo->mountname, "all") == 0)
+            global = mountinfo;
         if (strcmp (mountinfo->mountname, mount) == 0)
             break;
         mountinfo = mountinfo->next;
     }
+    if (mountinfo == NULL)
+        mountinfo = global;
     return mountinfo;
 }
 

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2005-04-06 01:29:12 UTC (rev 9113)
+++ icecast/branches/kh/icecast/src/source.c	2005-04-06 15:52:55 UTC (rev 9114)
@@ -1006,7 +1006,11 @@
 
 static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
 {
-    DEBUG1 ("Applying mount information for \"%s\"", source->mount);
+    if (strcmp (mountinfo->mountname, source->mount) == 0)
+        INFO1 ("Applying mount information for \"%s\"", source->mount);
+    else
+        INFO2 ("Applying mount information for \"%s\" from \"%s\"",
+                source->mount, mountinfo->mountname);
     source->max_listeners = mountinfo->max_listeners;
     source->fallback_override = mountinfo->fallback_override;
     source->no_mount = mountinfo->no_mount;
@@ -1075,27 +1079,17 @@
 
 void source_update_settings (ice_config_t *config, source_t *source)
 {
-    mount_proxy *mountproxy = config->mounts;
+    mount_proxy *mountinfo = config_find_mount (config, source->mount);
 
     /* set global settings first */
     source->queue_size_limit = config->queue_size_limit;
     source->timeout = config->source_timeout;
     source->burst_size = config->burst_size;
-
     source->dumpfilename = NULL;
+    
+    if (mountinfo && source->file_only == 0)
+        source_apply_mount (source, mountinfo);
 
-    while (mountproxy)
-    {
-        if (strcmp (mountproxy->mountname, source->mount) == 0)
-        {
-            if (source->file_only)
-                WARN1 ("skipping fallback to file \"%s\"", source->mount);
-            else
-                source_apply_mount (source, mountproxy);
-            break;
-        }
-        mountproxy = mountproxy->next;
-    }
     if (source->fallback_mount)
         DEBUG1 ("fallback %s", source->fallback_mount);
     if (source->dumpfilename)



More information about the commits mailing list