mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Feature: Added instance UUID
This commit is contained in:
parent
64df027bee
commit
bf6da896de
18
src/global.c
18
src/global.c
@ -20,6 +20,9 @@
|
||||
|
||||
#include "icecasttypes.h"
|
||||
#include <igloo/ro.h>
|
||||
#include <igloo/uuid.h>
|
||||
#include <igloo/sp.h>
|
||||
#include <igloo/error.h>
|
||||
|
||||
#include "common/thread/thread.h"
|
||||
#include "common/avl/avl.h"
|
||||
@ -33,6 +36,8 @@ igloo_ro_t igloo_instance = igloo_RO_NULL;
|
||||
|
||||
static mutex_t _global_mutex;
|
||||
|
||||
static const char * _instance_uuid = NULL;
|
||||
|
||||
void global_initialize(void)
|
||||
{
|
||||
memset(&global, 0, sizeof(global));
|
||||
@ -47,6 +52,7 @@ void global_shutdown(void)
|
||||
thread_mutex_destroy(&_global_mutex);
|
||||
igloo_ro_unref(&global.modulecontainer);
|
||||
avl_tree_free(global.source_tree, NULL);
|
||||
igloo_sp_unref(&_instance_uuid, igloo_instance);
|
||||
}
|
||||
|
||||
void global_lock(void)
|
||||
@ -58,3 +64,15 @@ void global_unlock(void)
|
||||
{
|
||||
thread_mutex_unlock(&_global_mutex);
|
||||
}
|
||||
|
||||
const char * global_instance_uuid(void)
|
||||
{
|
||||
if (_instance_uuid)
|
||||
return _instance_uuid;
|
||||
|
||||
if (igloo_uuid_new_random_sp(&_instance_uuid, igloo_instance) != igloo_ERROR_NONE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _instance_uuid;
|
||||
}
|
||||
|
@ -61,4 +61,6 @@ void global_shutdown(void);
|
||||
void global_lock(void);
|
||||
void global_unlock(void);
|
||||
|
||||
const char * global_instance_uuid(void);
|
||||
|
||||
#endif /* __GLOBAL_H__ */
|
||||
|
@ -663,6 +663,7 @@ void stats_global (ice_config_t *config)
|
||||
stats_event(NULL, "host", config->hostname);
|
||||
stats_event(NULL, "location", config->location);
|
||||
stats_event(NULL, "admin", config->admin);
|
||||
stats_event(NULL, "instance_uuid", global_instance_uuid());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user