Commit 7b9b8e70 authored by Karl Heyes's avatar Karl Heyes

The _inc/_dec routines can race causing incorrect values as they don't account

for unprocessed stat events.  Here I push the actual calculations to the stats
thread. The API is maintained however all stats for a specific source can be
dropped with one call now.

svn path=/icecast/trunk/icecast/; revision=8090
parent 80561957
......@@ -745,7 +745,7 @@ static void source_shutdown (source_t *source)
/* delete this sources stats */
stats_event_dec(NULL, "sources");
stats_event(source->mount, "listeners", NULL);
stats_event(source->mount, NULL, NULL);
/* we don't remove the source from the tree here, it may be a relay and
therefore reserved */
......
This diff is collapsed.
......@@ -38,6 +38,7 @@ typedef struct _stats_event_tag
char *source;
char *name;
char *value;
int action;
struct _stats_event_tag *next;
} stats_event_t;
......@@ -77,11 +78,11 @@ void stats_shutdown();
stats_t *stats_get_stats();
void stats_event(char *source, char *name, char *value);
void stats_event_args(char *source, char *name, char *format, ...);
void stats_event_inc(char *source, char *name);
void stats_event_add(char *source, char *name, unsigned long value);
void stats_event_dec(char *source, char *name);
void stats_event(const char *source, const char *name, const char *value);
void stats_event_args(const char *source, char *name, char *format, ...);
void stats_event_inc(const char *source, const char *name);
void stats_event_add(const char *source, const char *name, unsigned long value);
void stats_event_dec(const char *source, const char *name);
void *stats_connection(void *arg);
void *stats_callback(void *arg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment