mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
YP fixup for unusual cases. Inactive on-demand relays were not sending certain
details to stats engine. On YP remove, make sure we find all nodes for that montpoint not just the first. Allow at least 20mins from a failed touch before next add, allows YP to give a longer wait period for misconfigured setups by issuing a TouchFreq header on rejection. svn path=/icecast/trunk/icecast/; revision=14787
This commit is contained in:
parent
cdfeb30444
commit
a3d1ff8098
24
src/source.c
24
src/source.c
@ -989,7 +989,7 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
||||
|
||||
/* stream name */
|
||||
if (mountinfo && mountinfo->stream_name)
|
||||
str = mountinfo->stream_name;
|
||||
stats_event (source->mount, "server_name", mountinfo->stream_name);
|
||||
else
|
||||
{
|
||||
do {
|
||||
@ -1001,13 +1001,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
||||
if (str) break;
|
||||
str = "Unspecified name";
|
||||
} while (0);
|
||||
if (source->format)
|
||||
stats_event_conv (source->mount, "server_name", str, source->format->charset);
|
||||
}
|
||||
if (str && source->format)
|
||||
stats_event_conv (source->mount, "server_name", str, source->format->charset);
|
||||
|
||||
/* stream description */
|
||||
if (mountinfo && mountinfo->stream_description)
|
||||
str = mountinfo->stream_description;
|
||||
stats_event (source->mount, "server_description", mountinfo->stream_description);
|
||||
else
|
||||
{
|
||||
do {
|
||||
@ -1019,13 +1019,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
||||
if (str) break;
|
||||
str = "Unspecified description";
|
||||
} while (0);
|
||||
if (source->format)
|
||||
stats_event_conv (source->mount, "server_description", str, source->format->charset);
|
||||
}
|
||||
if (str && source->format)
|
||||
stats_event_conv (source->mount, "server_description", str, source->format->charset);
|
||||
|
||||
/* stream URL */
|
||||
if (mountinfo && mountinfo->stream_url)
|
||||
str = mountinfo->stream_url;
|
||||
stats_event (source->mount, "server_url", mountinfo->stream_url);
|
||||
else
|
||||
{
|
||||
do {
|
||||
@ -1036,13 +1036,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
||||
str = httpp_getvar (parser, "x-audiocast-url");
|
||||
if (str) break;
|
||||
} while (0);
|
||||
if (str && source->format)
|
||||
stats_event_conv (source->mount, "server_url", str, source->format->charset);
|
||||
}
|
||||
if (str && source->format)
|
||||
stats_event_conv (source->mount, "server_url", str, source->format->charset);
|
||||
|
||||
/* stream genre */
|
||||
if (mountinfo && mountinfo->stream_genre)
|
||||
str = mountinfo->stream_genre;
|
||||
stats_event (source->mount, "genre", mountinfo->stream_genre);
|
||||
else
|
||||
{
|
||||
do {
|
||||
@ -1054,9 +1054,9 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
||||
if (str) break;
|
||||
str = "various";
|
||||
} while (0);
|
||||
if (source->format)
|
||||
stats_event_conv (source->mount, "genre", str, source->format->charset);
|
||||
}
|
||||
if (str && source->format)
|
||||
stats_event_conv (source->mount, "genre", str, source->format->charset);
|
||||
|
||||
/* stream bitrate */
|
||||
if (mountinfo && mountinfo->bitrate)
|
||||
|
26
src/yp.c
26
src/yp.c
@ -316,10 +316,19 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post)
|
||||
ERROR3 ("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
|
||||
yp->next_update += 7200;
|
||||
}
|
||||
else
|
||||
if (yp->process == do_yp_touch)
|
||||
{
|
||||
/* At this point the touch request failed, either because they rejected our session
|
||||
* or the server isn't accessible. This means we have to wait before doing another
|
||||
* add request. We have a minimum delay but we could allow the directory server to
|
||||
* give us a wait time using the TouchFreq header. This time could be given in such
|
||||
* cases as a firewall block or incorrect listenurl.
|
||||
*/
|
||||
if (yp->touch_interval < 1200)
|
||||
yp->next_update += 1200;
|
||||
else
|
||||
yp->next_update += yp->touch_interval;
|
||||
INFO3 ("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
|
||||
yp->next_update += 1200;
|
||||
}
|
||||
yp->process = do_yp_add;
|
||||
free (yp->sid);
|
||||
@ -904,9 +913,18 @@ void yp_remove (const char *mount)
|
||||
thread_rwlock_rlock (&yp_lock);
|
||||
while (server)
|
||||
{
|
||||
ypdata_t *yp = find_yp_mount (server->mounts, mount);
|
||||
if (yp)
|
||||
ypdata_t *list = server->mounts;
|
||||
|
||||
while (1)
|
||||
{
|
||||
ypdata_t *yp = find_yp_mount (list, mount);
|
||||
if (yp == NULL)
|
||||
break;
|
||||
if (yp->release || yp->remove)
|
||||
{
|
||||
list = yp->next;
|
||||
continue; /* search again these are old entries */
|
||||
}
|
||||
DEBUG2 ("release %s on YP %s", mount, server->url);
|
||||
yp->release = 1;
|
||||
yp->next_update = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user