[xiph-commits] r13490 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Wed Aug 8 19:51:53 PDT 2007
Author: karl
Date: 2007-08-08 19:51:53 -0700 (Wed, 08 Aug 2007)
New Revision: 13490
Modified:
icecast/trunk/icecast/src/connection.c
Log:
prevent race case when dealing with shoutcast style source clients and update
response headers to those clients.
Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c 2007-08-09 01:17:57 UTC (rev 13489)
+++ icecast/trunk/icecast/src/connection.c 2007-08-09 02:51:53 UTC (rev 13490)
@@ -311,6 +311,7 @@
if (_con_queue == NULL)
_con_queue_tail = &_con_queue;
thread_mutex_unlock (&_con_queue_mutex);
+ node->next = NULL;
}
return node;
}
@@ -385,10 +386,12 @@
if (pass_it)
{
+ thread_mutex_lock (&_req_queue_mutex);
if ((client_queue_t **)_req_queue_tail == &(node->next))
_req_queue_tail = (volatile client_queue_t **)node_ref;
*node_ref = node->next;
node->next = NULL;
+ thread_mutex_unlock (&_req_queue_mutex);
_add_connection (node);
continue;
}
@@ -397,9 +400,11 @@
{
if (len == 0 || client->con->error)
{
+ thread_mutex_lock (&_req_queue_mutex);
if ((client_queue_t **)_req_queue_tail == &node->next)
_req_queue_tail = (volatile client_queue_t **)node_ref;
*node_ref = node->next;
+ thread_mutex_unlock (&_req_queue_mutex);
client_destroy (client);
free (node);
continue;
@@ -927,7 +932,7 @@
client->respcode = 200;
/* 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");
+ sock_write (client->con->sock, "OK2\r\nicy-caps:11\r\n\r\n");
node->offset -= (headers - client->refbuf->data);
memmove (client->refbuf->data, headers, node->offset+1);
node->shoutcast = 2;
More information about the commits
mailing list