mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
merge from branch, stats client details are not being removed when they exit
svn path=/icecast/trunk/icecast/; revision=9195
This commit is contained in:
parent
acd1b8ad96
commit
9253bf7248
27
src/stats.c
27
src/stats.c
@ -598,6 +598,25 @@ static void *_stats_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* you must have the _stats_mutex locked here */
|
||||
static void _unregister_listener(stats_event_t **queue)
|
||||
{
|
||||
event_listener_t **prev = (event_listener_t **)&_event_listeners,
|
||||
*current = *prev;
|
||||
while (current)
|
||||
{
|
||||
if (current->queue == queue)
|
||||
{
|
||||
*prev = current->next;
|
||||
free (current);
|
||||
break;
|
||||
}
|
||||
prev = ¤t->next;
|
||||
current = *prev;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* you must have the _stats_mutex locked here */
|
||||
static void _register_listener(stats_event_t **queue, mutex_t *mutex)
|
||||
{
|
||||
@ -761,6 +780,8 @@ void *stats_connection(void *arg)
|
||||
mutex_t local_event_mutex;
|
||||
stats_event_t *event;
|
||||
|
||||
INFO0 ("stats client starting");
|
||||
|
||||
/* increment the thread count */
|
||||
thread_mutex_lock(&_stats_mutex);
|
||||
_stats_threads++;
|
||||
@ -789,12 +810,14 @@ void *stats_connection(void *arg)
|
||||
thread_mutex_unlock(&local_event_mutex);
|
||||
}
|
||||
|
||||
thread_mutex_destroy(&local_event_mutex);
|
||||
|
||||
thread_mutex_lock(&_stats_mutex);
|
||||
_unregister_listener (&local_event_queue);
|
||||
_stats_threads--;
|
||||
thread_mutex_unlock(&_stats_mutex);
|
||||
|
||||
thread_mutex_destroy(&local_event_mutex);
|
||||
INFO0 ("stats client finished");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user