[xiph-commits] r9772 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Thu Aug 18 13:37:39 PDT 2005
Author: karl
Date: 2005-08-18 13:37:35 -0700 (Thu, 18 Aug 2005)
New Revision: 9772
Modified:
icecast/trunk/icecast/src/client.c
icecast/trunk/icecast/src/connection.c
icecast/trunk/icecast/src/source.c
Log:
merge fix, oddcast (maybe other shoutcast source clients) don't wait for OK
response, so we may have surplus data already read, so keep it.
Modified: icecast/trunk/icecast/src/client.c
===================================================================
--- icecast/trunk/icecast/src/client.c 2005-08-18 20:26:30 UTC (rev 9771)
+++ icecast/trunk/icecast/src/client.c 2005-08-18 20:37:35 UTC (rev 9772)
@@ -120,7 +120,7 @@
if (client->refbuf->len < len)
len = client->refbuf->len;
memcpy (buf, client->refbuf->data, len);
- if (client->refbuf->len < len)
+ if (len < client->refbuf->len)
{
char *ptr = client->refbuf->data;
memmove (ptr, ptr+len, client->refbuf->len - len);
Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c 2005-08-18 20:26:30 UTC (rev 9771)
+++ icecast/trunk/icecast/src/connection.c 2005-08-18 20:37:35 UTC (rev 9772)
@@ -765,10 +765,14 @@
}
else
{
+ refbuf_t *ok = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->respcode = 200;
- snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+ snprintf (ok->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\n\r\n");
- client->refbuf->len = strlen (client->refbuf->data);
+ ok->len = strlen (ok->data);
+ /* we may have unprocessed data read in, so don't overwrite it */
+ ok->associated = client->refbuf;
+ client->refbuf = ok;
fserve_add_client_callback (client, source_client_callback, source);
}
}
Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c 2005-08-18 20:26:30 UTC (rev 9771)
+++ icecast/trunk/icecast/src/source.c 2005-08-18 20:37:35 UTC (rev 9772)
@@ -1200,6 +1200,7 @@
{
const char *agent;
source_t *source = arg;
+ refbuf_t *old_data = client->refbuf;
if (client->con->error)
{
@@ -1210,6 +1211,9 @@
client_destroy (client);
return;
}
+ client->refbuf = old_data->associated;
+ old_data->associated = NULL;
+ refbuf_release (old_data);
stats_event (source->mount, "source_ip", source->client->con->ip);
agent = httpp_getvar (source->client->parser, "user-agent");
if (agent)
More information about the commits
mailing list