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
@ -54,10 +54,10 @@ format_type_t format_get_type(char *contenttype)
|
||||
return FORMAT_TYPE_OGG; /* Backwards compatibility */
|
||||
else if(strcmp(contenttype, "application/ogg") == 0)
|
||||
return FORMAT_TYPE_OGG; /* Now blessed by IANA */
|
||||
else
|
||||
else
|
||||
/* We default to the Generic format handler, which
|
||||
can handle many more formats than just mp3 */
|
||||
return FORMAT_TYPE_GENERIC;
|
||||
return FORMAT_TYPE_GENERIC;
|
||||
}
|
||||
|
||||
int format_get_plugin(format_type_t type, source_t *source)
|
||||
|
17
src/slave.c
17
src/slave.c
@ -292,7 +292,6 @@ static void check_relay_stream (relay_server *relay)
|
||||
relay->thread = NULL;
|
||||
relay->cleanup = 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)
|
||||
{
|
||||
if (to_free->running && to_free->source)
|
||||
if (to_free->source)
|
||||
{
|
||||
DEBUG1 ("source shutdown request on \"%s\"", to_free->localmount);
|
||||
to_free->source->running = 0;
|
||||
thread_join (to_free->thread);
|
||||
update_settings = 1;
|
||||
if (to_free->running)
|
||||
{
|
||||
/* relay has been removed from xml, shut down active relay */
|
||||
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);
|
||||
}
|
||||
|
@ -432,7 +432,8 @@ static refbuf_t *get_next_buffer (source_t *source)
|
||||
{
|
||||
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");
|
||||
source->running = 0;
|
||||
}
|
||||
@ -707,8 +708,8 @@ void source_main (source_t *source)
|
||||
/* update the stats if need be */
|
||||
if (source->listeners != listeners)
|
||||
{
|
||||
INFO2("listener count on %s now %ld", source->mount, source->listeners);
|
||||
stats_event_args (source->mount, "listeners", "%d", source->listeners);
|
||||
INFO2("listener count on %s now %lu", source->mount, source->listeners);
|
||||
stats_event_args (source->mount, "listeners", "%lu", source->listeners);
|
||||
}
|
||||
|
||||
/* 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
|
||||
{
|
||||
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);
|
||||
}
|
||||
DEBUG1 ("public set to %d", source->yp_public);
|
||||
|
@ -52,7 +52,6 @@ typedef struct source_tag
|
||||
unsigned long listeners;
|
||||
long max_listeners;
|
||||
int yp_public;
|
||||
int yp_prevent;
|
||||
struct auth_tag *authenticator;
|
||||
int fallback_override;
|
||||
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)
|
||||
return;
|
||||
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped == NULL)
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case YP_SERVER_NAME:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->server_name)
|
||||
free (yp->server_name);
|
||||
yp->server_name = escaped;
|
||||
}
|
||||
free (yp->server_name);
|
||||
yp->server_name = escaped;
|
||||
break;
|
||||
case YP_SERVER_DESC:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->server_desc)
|
||||
free (yp->server_desc);
|
||||
yp->server_desc = escaped;
|
||||
}
|
||||
free (yp->server_desc);
|
||||
yp->server_desc = escaped;
|
||||
break;
|
||||
case YP_SERVER_GENRE:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->server_genre)
|
||||
free (yp->server_genre);
|
||||
yp->server_genre = escaped;
|
||||
}
|
||||
free (yp->server_genre);
|
||||
yp->server_genre = escaped;
|
||||
break;
|
||||
case YP_SERVER_URL:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->url)
|
||||
free (yp->url);
|
||||
yp->url = escaped;
|
||||
}
|
||||
free (yp->url);
|
||||
yp->url = escaped;
|
||||
break;
|
||||
case YP_BITRATE:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->bitrate)
|
||||
free (yp->bitrate);
|
||||
yp->bitrate = escaped;
|
||||
}
|
||||
free (yp->bitrate);
|
||||
yp->bitrate = escaped;
|
||||
break;
|
||||
case YP_AUDIO_INFO:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
free (yp->audio_info);
|
||||
yp->audio_info = escaped;
|
||||
}
|
||||
free (yp->audio_info);
|
||||
yp->audio_info = escaped;
|
||||
break;
|
||||
case YP_SERVER_TYPE:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->server_type)
|
||||
free (yp->server_type);
|
||||
yp->server_type = escaped;
|
||||
}
|
||||
free (yp->server_type);
|
||||
yp->server_type = escaped;
|
||||
break;
|
||||
case YP_CURRENT_SONG:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->current_song)
|
||||
free (yp->current_song);
|
||||
yp->current_song = escaped;
|
||||
}
|
||||
free (yp->current_song);
|
||||
yp->current_song = escaped;
|
||||
break;
|
||||
case YP_CLUSTER_PASSWORD:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
if (yp->cluster_password)
|
||||
free (yp->cluster_password);
|
||||
yp->cluster_password = escaped;
|
||||
}
|
||||
free (yp->cluster_password);
|
||||
yp->cluster_password = escaped;
|
||||
break;
|
||||
case YP_SUBTYPE:
|
||||
escaped = util_url_escape(info);
|
||||
if (escaped)
|
||||
{
|
||||
free (yp->subtype);
|
||||
yp->subtype = escaped;
|
||||
}
|
||||
free (yp->subtype);
|
||||
yp->subtype = escaped;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user