mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-11-03 04:17:17 -05:00
Feature: Added per-source instance UUID
This commit is contained in:
parent
ee72096d99
commit
2e1629503c
16
src/source.c
16
src/source.c
@ -39,6 +39,10 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#include <igloo/uuid.h>
|
||||
#include <igloo/sp.h>
|
||||
#include <igloo/error.h>
|
||||
|
||||
#include "common/thread/thread.h"
|
||||
#include "common/avl/avl.h"
|
||||
#include "common/httpp/httpp.h"
|
||||
@ -100,6 +104,12 @@ source_t *source_reserve (const char *mount)
|
||||
if (src == NULL)
|
||||
break;
|
||||
|
||||
if (igloo_uuid_new_random_sp(&src->instance_uuid, igloo_instance) != igloo_ERROR_NONE) {
|
||||
free(src);
|
||||
src = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
src->client_tree = avl_tree_new(client_compare, NULL);
|
||||
src->pending_tree = avl_tree_new(client_compare, NULL);
|
||||
src->history = playlist_new(10 /* DOCUMENT: default is max_tracks=10. */);
|
||||
@ -116,6 +126,11 @@ source_t *source_reserve (const char *mount)
|
||||
} while (0);
|
||||
|
||||
avl_tree_unlock(global.source_tree);
|
||||
|
||||
if (src) {
|
||||
stats_event(mount, "instance_uuid", src->instance_uuid);
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
@ -331,6 +346,7 @@ void source_free_source (source_t *source)
|
||||
yp_remove (source->mount);
|
||||
|
||||
refobject_unref(source->identifier);
|
||||
igloo_sp_unref(&source->instance_uuid, igloo_instance);
|
||||
free (source->mount);
|
||||
free (source);
|
||||
|
||||
|
@ -49,6 +49,9 @@ struct source_tag {
|
||||
char *mount; // TODO: Should we at some point migrate away from this to only use identifier?
|
||||
mount_identifier_t *identifier;
|
||||
|
||||
/* Instance UUID for this source. Will be different every time a source is connected. */
|
||||
const char *instance_uuid;
|
||||
|
||||
/* If this source drops, try to move all clients to this fallback */
|
||||
char *fallback_mount;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user