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

karl at svn.xiph.org karl at svn.xiph.org
Wed Aug 31 10:33:08 PDT 2005


Author: karl
Date: 2005-08-31 10:33:04 -0700 (Wed, 31 Aug 2005)
New Revision: 9881

Modified:
   icecast/branches/kh/icecast/src/admin.c
   icecast/branches/kh/icecast/src/auth_htpasswd.c
   icecast/branches/kh/icecast/src/format_mp3.c
   icecast/branches/kh/icecast/src/yp.c
Log:
resync with fixes in trunk


Modified: icecast/branches/kh/icecast/src/admin.c
===================================================================
--- icecast/branches/kh/icecast/src/admin.c	2005-08-31 05:44:16 UTC (rev 9880)
+++ icecast/branches/kh/icecast/src/admin.c	2005-08-31 17:33:04 UTC (rev 9881)
@@ -837,7 +837,7 @@
 
     client->respcode = 200;
     config = config_get_config();
-    snprintf (client->refbuf->data, client->refbuf->len,
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
         "HTTP/1.0 200 OK\r\n"
         "Content-Type: audio/x-mpegurl\r\n"
         "Content-Disposition = attachment; filename=listen.m3u\r\n\r\n" 

Modified: icecast/branches/kh/icecast/src/auth_htpasswd.c
===================================================================
--- icecast/branches/kh/icecast/src/auth_htpasswd.c	2005-08-31 05:44:16 UTC (rev 9880)
+++ icecast/branches/kh/icecast/src/auth_htpasswd.c	2005-08-31 17:33:04 UTC (rev 9881)
@@ -129,8 +129,16 @@
     if (stat (htpasswd->filename, &file_stat) < 0)
     {
         WARN1 ("failed to check status of %s", htpasswd->filename);
+
+        /* Create a dummy users tree for things to use later */
+        thread_rwlock_wlock (&htpasswd->file_rwlock);
+        if(!htpasswd->users)
+            htpasswd->users = avl_tree_new(compare_users, NULL);
+        thread_rwlock_unlock (&htpasswd->file_rwlock);
+
         return;
     }
+
     if (file_stat.st_mtime == htpasswd->mtime)
     {
         /* common case, no update to file */

Modified: icecast/branches/kh/icecast/src/format_mp3.c
===================================================================
--- icecast/branches/kh/icecast/src/format_mp3.c	2005-08-31 05:44:16 UTC (rev 9880)
+++ icecast/branches/kh/icecast/src/format_mp3.c	2005-08-31 17:33:04 UTC (rev 9881)
@@ -197,7 +197,7 @@
 {
     mp3_state *source_mp3 = format->_state;
 
-    if (mount == NULL || mount->mp3_meta_interval <= 0)
+    if (mount == NULL || mount->mp3_meta_interval < 0)
     {
         char *metadata = httpp_getvar (client->parser, "icy-metaint");
         source_mp3->interval = -1;
@@ -376,6 +376,9 @@
                 /* change buf and len */
                 buf += remaining;
                 len -= remaining;
+                /* limit how much mp3 we send if using small intervals */
+                if (len > client_mp3->interval)
+                    len = client_mp3->interval;
             }
         }
         /* write any mp3, maybe after the metadata block */
@@ -640,16 +643,19 @@
     metadata = httpp_getvar(client->parser, "icy-metadata");
     if (metadata && atoi(metadata))
     {
-        if (source_mp3->interval > 0)
+        if (source_mp3->interval >= 0)
             client_mp3->interval = source_mp3->interval;
         else
             client_mp3->interval = ICY_METADATA_INTERVAL;
-        bytes = snprintf (ptr, remaining, "icy-metaint:%u\r\n",
-                client_mp3->interval);
-        if (bytes > 0)
+        if (client_mp3->interval)
         {
-            remaining -= bytes;
-            ptr += bytes;
+            bytes = snprintf (ptr, remaining, "icy-metaint:%u\r\n",
+                    client_mp3->interval);
+            if (bytes > 0)
+            {
+                remaining -= bytes;
+                ptr += bytes;
+            }
         }
     }
     bytes = snprintf (ptr, remaining, "\r\n");

Modified: icecast/branches/kh/icecast/src/yp.c
===================================================================
--- icecast/branches/kh/icecast/src/yp.c	2005-08-31 05:44:16 UTC (rev 9880)
+++ icecast/branches/kh/icecast/src/yp.c	2005-08-31 17:33:04 UTC (rev 9881)
@@ -833,8 +833,7 @@
     {
         ypdata_t *yp;
 
-        /* check if YP entry is known about, as source_t is unique this
-         * should only apply to the restarting of on-demand relays */
+        /* on-demand relays may already have a YP entry */
         yp = find_yp_mount (server->mounts, mount);
         if (yp == NULL)
         {



More information about the commits mailing list