mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
missed a merge for stats update for when the relay ends. The rest is minor
stuff, type check cleanup and code reduction in YP svn path=/icecast/trunk/icecast/; revision=9331
This commit is contained in:
parent
f1d39a8788
commit
72ad63f763
17
src/slave.c
17
src/slave.c
@ -292,7 +292,6 @@ static void check_relay_stream (relay_server *relay)
|
|||||||
relay->thread = NULL;
|
relay->thread = NULL;
|
||||||
relay->cleanup = 0;
|
relay->cleanup = 0;
|
||||||
relay->running = 0;
|
relay->running = 0;
|
||||||
update_settings = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,12 +384,18 @@ static void relay_check_streams (relay_server *to_start, relay_server *to_free)
|
|||||||
|
|
||||||
while (to_free)
|
while (to_free)
|
||||||
{
|
{
|
||||||
if (to_free->running && to_free->source)
|
if (to_free->source)
|
||||||
{
|
{
|
||||||
DEBUG1 ("source shutdown request on \"%s\"", to_free->localmount);
|
if (to_free->running)
|
||||||
to_free->source->running = 0;
|
{
|
||||||
thread_join (to_free->thread);
|
/* relay has been removed from xml, shut down active relay */
|
||||||
update_settings = 1;
|
DEBUG1 ("source shutdown request on \"%s\"", to_free->localmount);
|
||||||
|
to_free->source->running = 0;
|
||||||
|
thread_join (to_free->thread);
|
||||||
|
slave_rebuild_mounts();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stats_event (to_free->localmount, NULL, NULL);
|
||||||
}
|
}
|
||||||
to_free = relay_free (to_free);
|
to_free = relay_free (to_free);
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,8 @@ static refbuf_t *get_next_buffer (source_t *source)
|
|||||||
{
|
{
|
||||||
if (source->last_read + (time_t)source->timeout < current)
|
if (source->last_read + (time_t)source->timeout < current)
|
||||||
{
|
{
|
||||||
DEBUG3 ("last %ld, timeout %d, now %ld", source->last_read, source->timeout, current);
|
DEBUG3 ("last %ld, timeout %d, now %ld", (long)source->last_read,
|
||||||
|
source->timeout, (long)current);
|
||||||
WARN0 ("Disconnecting source due to socket timeout");
|
WARN0 ("Disconnecting source due to socket timeout");
|
||||||
source->running = 0;
|
source->running = 0;
|
||||||
}
|
}
|
||||||
@ -707,8 +708,8 @@ void source_main (source_t *source)
|
|||||||
/* update the stats if need be */
|
/* update the stats if need be */
|
||||||
if (source->listeners != listeners)
|
if (source->listeners != listeners)
|
||||||
{
|
{
|
||||||
INFO2("listener count on %s now %ld", source->mount, source->listeners);
|
INFO2("listener count on %s now %lu", source->mount, source->listeners);
|
||||||
stats_event_args (source->mount, "listeners", "%d", source->listeners);
|
stats_event_args (source->mount, "listeners", "%lu", source->listeners);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lets reduce the queue, any lagging clients should of been
|
/* lets reduce the queue, any lagging clients should of been
|
||||||
@ -1054,7 +1055,7 @@ void source_update_settings (ice_config_t *config, source_t *source, mount_proxy
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf [10];
|
char buf [10];
|
||||||
snprintf (buf, sizeof (buf), "%lu", source->max_listeners);
|
snprintf (buf, sizeof (buf), "%ld", source->max_listeners);
|
||||||
stats_event (source->mount, "max_listeners", buf);
|
stats_event (source->mount, "max_listeners", buf);
|
||||||
}
|
}
|
||||||
DEBUG1 ("public set to %d", source->yp_public);
|
DEBUG1 ("public set to %d", source->yp_public);
|
||||||
|
@ -52,7 +52,6 @@ typedef struct source_tag
|
|||||||
unsigned long listeners;
|
unsigned long listeners;
|
||||||
long max_listeners;
|
long max_listeners;
|
||||||
int yp_public;
|
int yp_public;
|
||||||
int yp_prevent;
|
|
||||||
struct auth_tag *authenticator;
|
struct auth_tag *authenticator;
|
||||||
int fallback_override;
|
int fallback_override;
|
||||||
int no_mount;
|
int no_mount;
|
||||||
|
92
src/yp.c
92
src/yp.c
@ -762,95 +762,51 @@ static void add_yp_info (ypdata_t *yp, void *info, int type)
|
|||||||
if (!info)
|
if (!info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
escaped = util_url_escape(info);
|
||||||
|
if (escaped == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case YP_SERVER_NAME:
|
case YP_SERVER_NAME:
|
||||||
escaped = util_url_escape(info);
|
free (yp->server_name);
|
||||||
if (escaped)
|
yp->server_name = escaped;
|
||||||
{
|
|
||||||
if (yp->server_name)
|
|
||||||
free (yp->server_name);
|
|
||||||
yp->server_name = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_SERVER_DESC:
|
case YP_SERVER_DESC:
|
||||||
escaped = util_url_escape(info);
|
free (yp->server_desc);
|
||||||
if (escaped)
|
yp->server_desc = escaped;
|
||||||
{
|
|
||||||
if (yp->server_desc)
|
|
||||||
free (yp->server_desc);
|
|
||||||
yp->server_desc = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_SERVER_GENRE:
|
case YP_SERVER_GENRE:
|
||||||
escaped = util_url_escape(info);
|
free (yp->server_genre);
|
||||||
if (escaped)
|
yp->server_genre = escaped;
|
||||||
{
|
|
||||||
if (yp->server_genre)
|
|
||||||
free (yp->server_genre);
|
|
||||||
yp->server_genre = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_SERVER_URL:
|
case YP_SERVER_URL:
|
||||||
escaped = util_url_escape(info);
|
free (yp->url);
|
||||||
if (escaped)
|
yp->url = escaped;
|
||||||
{
|
|
||||||
if (yp->url)
|
|
||||||
free (yp->url);
|
|
||||||
yp->url = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_BITRATE:
|
case YP_BITRATE:
|
||||||
escaped = util_url_escape(info);
|
free (yp->bitrate);
|
||||||
if (escaped)
|
yp->bitrate = escaped;
|
||||||
{
|
|
||||||
if (yp->bitrate)
|
|
||||||
free (yp->bitrate);
|
|
||||||
yp->bitrate = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_AUDIO_INFO:
|
case YP_AUDIO_INFO:
|
||||||
escaped = util_url_escape(info);
|
free (yp->audio_info);
|
||||||
if (escaped)
|
yp->audio_info = escaped;
|
||||||
{
|
|
||||||
free (yp->audio_info);
|
|
||||||
yp->audio_info = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_SERVER_TYPE:
|
case YP_SERVER_TYPE:
|
||||||
escaped = util_url_escape(info);
|
free (yp->server_type);
|
||||||
if (escaped)
|
yp->server_type = escaped;
|
||||||
{
|
|
||||||
if (yp->server_type)
|
|
||||||
free (yp->server_type);
|
|
||||||
yp->server_type = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_CURRENT_SONG:
|
case YP_CURRENT_SONG:
|
||||||
escaped = util_url_escape(info);
|
free (yp->current_song);
|
||||||
if (escaped)
|
yp->current_song = escaped;
|
||||||
{
|
|
||||||
if (yp->current_song)
|
|
||||||
free (yp->current_song);
|
|
||||||
yp->current_song = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_CLUSTER_PASSWORD:
|
case YP_CLUSTER_PASSWORD:
|
||||||
escaped = util_url_escape(info);
|
free (yp->cluster_password);
|
||||||
if (escaped)
|
yp->cluster_password = escaped;
|
||||||
{
|
|
||||||
if (yp->cluster_password)
|
|
||||||
free (yp->cluster_password);
|
|
||||||
yp->cluster_password = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case YP_SUBTYPE:
|
case YP_SUBTYPE:
|
||||||
escaped = util_url_escape(info);
|
free (yp->subtype);
|
||||||
if (escaped)
|
yp->subtype = escaped;
|
||||||
{
|
|
||||||
free (yp->subtype);
|
|
||||||
yp->subtype = escaped;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user