[xiph-commits] r9195 - icecast/trunk/icecast/src
karl at motherfish-iii.xiph.org
karl at motherfish-iii.xiph.org
Sat Apr 30 19:04:14 PDT 2005
Author: karl
Date: 2005-04-30 19:04:11 -0700 (Sat, 30 Apr 2005)
New Revision: 9195
Modified:
icecast/trunk/icecast/src/stats.c
Log:
merge from branch, stats client details are not being removed when they exit
Modified: icecast/trunk/icecast/src/stats.c
===================================================================
--- icecast/trunk/icecast/src/stats.c 2005-04-29 15:44:14 UTC (rev 9194)
+++ icecast/trunk/icecast/src/stats.c 2005-05-01 02:04:11 UTC (rev 9195)
@@ -599,6 +599,25 @@
}
/* 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)
{
event_listener_t *node;
@@ -761,6 +780,8 @@
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 @@
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;
}
More information about the commits
mailing list