mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
small cleanups. redundant mutex removed, updates to log messages
svn path=/icecast/trunk/icecast/; revision=9443
This commit is contained in:
parent
c59a276ab5
commit
88bfe6ba6a
21
src/admin.c
21
src/admin.c
@ -234,13 +234,16 @@ xmlDocPtr admin_build_sourcelist (const char *mount)
|
||||
xmlNewChild(srcnode, NULL, "fallback",
|
||||
(source->fallback_mount != NULL)?
|
||||
source->fallback_mount:"");
|
||||
snprintf(buf, sizeof(buf), "%ld", source->listeners);
|
||||
snprintf (buf, sizeof(buf), "%lu", source->listeners);
|
||||
xmlNewChild(srcnode, NULL, "listeners", buf);
|
||||
snprintf(buf, sizeof(buf), "%lu",
|
||||
(unsigned long)(now - source->con->con_time));
|
||||
xmlNewChild(srcnode, NULL, "Connected", buf);
|
||||
xmlNewChild(srcnode, NULL, "content-type",
|
||||
source->format->contenttype);
|
||||
if (source->running)
|
||||
{
|
||||
snprintf (buf, sizeof(buf), "%lu",
|
||||
(unsigned long)(now - source->con->con_time));
|
||||
xmlNewChild (srcnode, NULL, "Connected", buf);
|
||||
xmlNewChild (srcnode, NULL, "content-type",
|
||||
source->format->contenttype);
|
||||
}
|
||||
if (source->authenticator) {
|
||||
xmlNewChild(srcnode, NULL, "authenticator",
|
||||
source->authenticator->type);
|
||||
@ -596,6 +599,8 @@ static void command_move_clients(client_t *client, source_t *source,
|
||||
return;
|
||||
}
|
||||
|
||||
INFO2 ("source is \"%s\", destination is \"%s\"", source->mount, dest->mount);
|
||||
|
||||
doc = xmlNewDoc("1.0");
|
||||
node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
|
||||
xmlDocSetRootElement(doc, node);
|
||||
@ -632,7 +637,7 @@ static void command_show_listeners(client_t *client, source_t *source,
|
||||
xmlDocSetRootElement(doc, node);
|
||||
|
||||
memset(buf, '\000', sizeof(buf));
|
||||
snprintf(buf, sizeof(buf)-1, "%ld", source->listeners);
|
||||
snprintf (buf, sizeof(buf), "%lu", source->listeners);
|
||||
xmlNewChild(srcnode, NULL, "Listeners", buf);
|
||||
|
||||
avl_tree_rlock(source->client_tree);
|
||||
@ -882,7 +887,7 @@ static void command_metadata(client_t *client, source_t *source,
|
||||
if (song)
|
||||
{
|
||||
plugin->set_tag (plugin, "song", song);
|
||||
DEBUG2("Metadata on mountpoint %s changed to \"%s\"", source->mount, song);
|
||||
INFO2 ("Metadata on mountpoint %s changed to \"%s\"", source->mount, song);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,13 +88,11 @@ static void _add_server(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
|
||||
static void create_locks() {
|
||||
thread_mutex_create(&_locks.relay_lock);
|
||||
thread_mutex_create(&_locks.mounts_lock);
|
||||
thread_rwlock_create(&_locks.config_lock);
|
||||
}
|
||||
|
||||
static void release_locks() {
|
||||
thread_mutex_destroy(&_locks.relay_lock);
|
||||
thread_mutex_destroy(&_locks.mounts_lock);
|
||||
thread_rwlock_destroy(&_locks.config_lock);
|
||||
}
|
||||
|
||||
@ -182,7 +180,6 @@ void config_clear(ice_config_t *c)
|
||||
}
|
||||
thread_mutex_unlock(&(_locks.relay_lock));
|
||||
|
||||
thread_mutex_lock(&(_locks.mounts_lock));
|
||||
mount = c->mounts;
|
||||
while(mount) {
|
||||
nextmount = mount->next;
|
||||
@ -217,7 +214,6 @@ void config_clear(ice_config_t *c)
|
||||
free(mount);
|
||||
mount = nextmount;
|
||||
}
|
||||
thread_mutex_unlock(&(_locks.mounts_lock));
|
||||
|
||||
alias = c->aliases;
|
||||
while(alias) {
|
||||
|
@ -163,7 +163,6 @@ typedef struct ice_config_tag
|
||||
typedef struct {
|
||||
rwlock_t config_lock;
|
||||
mutex_t relay_lock;
|
||||
mutex_t mounts_lock;
|
||||
} ice_config_locks;
|
||||
|
||||
void config_initialize(void);
|
||||
|
@ -260,11 +260,11 @@ static void *start_relay_stream (void *arg)
|
||||
return NULL;
|
||||
} while (0);
|
||||
|
||||
DEBUG1 ("failed relay, fallback to %s", relay->source->fallback_mount);
|
||||
if (relay->source->fallback_mount)
|
||||
{
|
||||
source_t *fallback_source;
|
||||
|
||||
DEBUG1 ("failed relay, fallback to %s", relay->source->fallback_mount);
|
||||
avl_tree_rlock(global.source_tree);
|
||||
fallback_source = source_find_mount (relay->source->fallback_mount);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user