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

karl at svn.xiph.org karl at svn.xiph.org
Mon Sep 26 09:34:54 PDT 2005


Author: karl
Date: 2005-09-26 09:34:51 -0700 (Mon, 26 Sep 2005)
New Revision: 10076

Modified:
   icecast/trunk/icecast/src/connection.c
Log:
Fix a bug where a shoutcast source client (nsvtools) does not wait for the
OK response. Icecast was dropping the connection preventing the stream


Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c	2005-09-26 10:32:36 UTC (rev 10075)
+++ icecast/trunk/icecast/src/connection.c	2005-09-26 16:34:51 UTC (rev 10076)
@@ -872,7 +872,7 @@
 
     if (node->shoutcast == 1)
     {
-        char *source_password, *ptr;
+        char *source_password, *ptr, *headers;
         mount_proxy *mountinfo = config_find_mount (config, config->shoutcast_mount);
 
         if (mountinfo && mountinfo->password)
@@ -883,8 +883,14 @@
 
         /* Get rid of trailing \r\n or \n after password */
         ptr = strstr (client->refbuf->data, "\r\n");
-        if (ptr == NULL)
+        if (ptr)
+            headers = ptr+2;
+        else
+        {
             ptr = strstr (client->refbuf->data, "\n");
+            if (ptr)
+                headers = ptr+1;
+        }
 
         if (ptr == NULL)
         {
@@ -901,9 +907,9 @@
             /* send this non-blocking but if there is only a partial write
              * then leave to header timeout */
             sock_write (client->con->sock, "OK2\r\n");
-            memset (client->refbuf->data, 0, client->refbuf->len);
+            node->offset -= (headers - client->refbuf->data);
+            memmove (client->refbuf->data, headers, node->offset+1);
             node->shoutcast = 2;
-            node->offset = 0;
             /* we've checked the password, now send it back for reading headers */
             _add_request_queue (node);
             free (source_password);



More information about the commits mailing list