From c66246b25517a64f149bad0698c74900412b1a98 Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Fri, 16 Sep 2005 16:53:33 +0000 Subject: [PATCH] fix for race, client needs setup before adding to pending tree svn path=/icecast/trunk/icecast/; revision=10019 --- src/auth.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/auth.c b/src/auth.c index 326a06cb..7932161b 100644 --- a/src/auth.c +++ b/src/auth.c @@ -295,17 +295,18 @@ static int add_client_to_source (source_t *source, client_t *client) return -1; } while (1); - /* lets add the client to the active list */ - avl_tree_wlock (source->pending_tree); - avl_insert (source->pending_tree, client); - avl_tree_unlock (source->pending_tree); - stats_event_inc (NULL, "listener_connections"); client->write_to_client = format_generic_write_to_client; client->check_buffer = format_check_http_buffer; client->refbuf->len = PER_CLIENT_REFBUF_SIZE; memset (client->refbuf->data, 0, PER_CLIENT_REFBUF_SIZE); + /* lets add the client to the active list */ + avl_tree_wlock (source->pending_tree); + avl_insert (source->pending_tree, client); + avl_tree_unlock (source->pending_tree); + stats_event_inc (NULL, "listener_connections"); + if (source->running == 0 && source->on_demand) { /* enable on-demand relay to start, wake up the slave thread */