mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
add global listeners stat
svn path=/icecast/trunk/icecast/; revision=14016
This commit is contained in:
parent
dcffbb38ad
commit
ab75a3297f
@ -208,6 +208,7 @@ 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, "listeners");
|
||||||
stats_event_inc (NULL, "listener_connections");
|
stats_event_inc (NULL, "listener_connections");
|
||||||
stats_event_inc (source->mount, "listener_connections");
|
stats_event_inc (source->mount, "listener_connections");
|
||||||
}
|
}
|
||||||
|
@ -212,6 +212,9 @@ void source_clear_source (source_t *source)
|
|||||||
source->dumpfile = NULL;
|
source->dumpfile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source->listeners)
|
||||||
|
stats_event_sub (NULL, "listeners", source->listeners);
|
||||||
|
|
||||||
/* lets kick off any clients that are left on here */
|
/* lets kick off any clients that are left on here */
|
||||||
while (avl_get_first (source->client_tree))
|
while (avl_get_first (source->client_tree))
|
||||||
{
|
{
|
||||||
@ -716,6 +719,7 @@ void source_main (source_t *source)
|
|||||||
client_node = avl_get_next(client_node);
|
client_node = avl_get_next(client_node);
|
||||||
avl_delete(source->client_tree, (void *)client, _free_client);
|
avl_delete(source->client_tree, (void *)client, _free_client);
|
||||||
source->listeners--;
|
source->listeners--;
|
||||||
|
stats_event_dec (NULL, "listeners");
|
||||||
DEBUG0("Client removed");
|
DEBUG0("Client removed");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
18
src/stats.c
18
src/stats.c
@ -49,8 +49,9 @@
|
|||||||
#define STATS_EVENT_INC 1
|
#define STATS_EVENT_INC 1
|
||||||
#define STATS_EVENT_DEC 2
|
#define STATS_EVENT_DEC 2
|
||||||
#define STATS_EVENT_ADD 3
|
#define STATS_EVENT_ADD 3
|
||||||
#define STATS_EVENT_REMOVE 4
|
#define STATS_EVENT_SUB 4
|
||||||
#define STATS_EVENT_HIDDEN 5
|
#define STATS_EVENT_REMOVE 5
|
||||||
|
#define STATS_EVENT_HIDDEN 6
|
||||||
|
|
||||||
typedef struct _event_queue_tag
|
typedef struct _event_queue_tag
|
||||||
{
|
{
|
||||||
@ -343,6 +344,18 @@ void stats_event_add(const char *source, const char *name, unsigned long value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void stats_event_sub(const char *source, const char *name, unsigned long value)
|
||||||
|
{
|
||||||
|
stats_event_t *event = build_event (source, name, NULL);
|
||||||
|
if (event)
|
||||||
|
{
|
||||||
|
event->value = malloc (16);
|
||||||
|
snprintf (event->value, 16, "%ld", value);
|
||||||
|
event->action = STATS_EVENT_SUB;
|
||||||
|
queue_global_event (event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* decrease the value in the provided stat by 1 */
|
/* decrease the value in the provided stat by 1 */
|
||||||
void stats_event_dec(const char *source, const char *name)
|
void stats_event_dec(const char *source, const char *name)
|
||||||
{
|
{
|
||||||
@ -609,6 +622,7 @@ static void *_stats_thread(void *arg)
|
|||||||
stats_event (NULL, "connections", "0");
|
stats_event (NULL, "connections", "0");
|
||||||
stats_event (NULL, "sources", "0");
|
stats_event (NULL, "sources", "0");
|
||||||
stats_event (NULL, "stats", "0");
|
stats_event (NULL, "stats", "0");
|
||||||
|
stats_event (NULL, "listeners", "0");
|
||||||
|
|
||||||
/* global accumulating stats */
|
/* global accumulating stats */
|
||||||
stats_event (NULL, "client_connections", "0");
|
stats_event (NULL, "client_connections", "0");
|
||||||
|
@ -85,6 +85,7 @@ void stats_event_conv(const char *mount, const char *name,
|
|||||||
void stats_event_args(const char *source, char *name, char *format, ...);
|
void stats_event_args(const char *source, char *name, char *format, ...);
|
||||||
void stats_event_inc(const char *source, const char *name);
|
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_add(const char *source, const char *name, unsigned long value);
|
||||||
|
void stats_event_sub(const char *source, const char *name, unsigned long value);
|
||||||
void stats_event_dec(const char *source, const char *name);
|
void stats_event_dec(const char *source, const char *name);
|
||||||
void stats_event_hidden (const char *source, const char *name, int hidden);
|
void stats_event_hidden (const char *source, const char *name, int hidden);
|
||||||
void stats_event_time (const char *mount, const char *name);
|
void stats_event_time (const char *mount, const char *name);
|
||||||
|
Loading…
Reference in New Issue
Block a user