1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

fix possible segv case, and only increase certain listener stats when stream is

active (on demand relays may not actually start when triggered)

svn path=/icecast/trunk/icecast/; revision=13503
This commit is contained in:
Karl Heyes 2007-08-10 13:04:40 +00:00
parent fe5c9e62cc
commit 2b817daea2
2 changed files with 6 additions and 6 deletions

View File

@ -311,7 +311,6 @@ static int add_client_to_source (source_t *source, client_t *client)
avl_tree_wlock (source->pending_tree); avl_tree_wlock (source->pending_tree);
avl_insert (source->pending_tree, client); avl_insert (source->pending_tree, client);
avl_tree_unlock (source->pending_tree); avl_tree_unlock (source->pending_tree);
stats_event_inc (NULL, "listener_connections");
if (source->running == 0 && source->on_demand) if (source->running == 0 && source->on_demand)
{ {

View File

@ -101,10 +101,9 @@ static void find_client_start (source_t *source, client_t *client)
refbuf = source->stream_data_tail; refbuf = source->stream_data_tail;
else else
{ {
long size = 0; size_t size = client->intro_offset;
refbuf = source->burst_point; refbuf = source->burst_point;
size = client->intro_offset; while (size > 0 && refbuf && refbuf->next)
while (size > 0 && refbuf->next)
{ {
size -= refbuf->len; size -= refbuf->len;
refbuf = refbuf->next; refbuf = refbuf->next;
@ -129,7 +128,7 @@ static void find_client_start (source_t *source, client_t *client)
static int get_file_data (FILE *intro, client_t *client) static int get_file_data (FILE *intro, client_t *client)
{ {
refbuf_t *refbuf = client->refbuf; refbuf_t *refbuf = client->refbuf;
int bytes; size_t bytes;
if (intro == NULL || fseek (intro, client->intro_offset, SEEK_SET) < 0) if (intro == NULL || fseek (intro, client->intro_offset, SEEK_SET) < 0)
return 0; return 0;
@ -209,6 +208,8 @@ int format_check_http_buffer (source_t *source, client_t *client)
client->con->error = 1; client->con->error = 1;
return -1; return -1;
} }
stats_event_inc (NULL, "listener_connections");
stats_event_inc (source->mount, "listener_connections");
} }
if (client->pos == refbuf->len) if (client->pos == refbuf->len)