Commit a3d1ff80 authored by Karl Heyes's avatar Karl Heyes

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
parent cdfeb304
...@@ -989,7 +989,7 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) ...@@ -989,7 +989,7 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
/* stream name */ /* stream name */
if (mountinfo && mountinfo->stream_name) if (mountinfo && mountinfo->stream_name)
str = mountinfo->stream_name; stats_event (source->mount, "server_name", mountinfo->stream_name);
else else
{ {
do { do {
...@@ -1001,13 +1001,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) ...@@ -1001,13 +1001,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
if (str) break; if (str) break;
str = "Unspecified name"; str = "Unspecified name";
} while (0); } 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 */ /* stream description */
if (mountinfo && mountinfo->stream_description) if (mountinfo && mountinfo->stream_description)
str = mountinfo->stream_description; stats_event (source->mount, "server_description", mountinfo->stream_description);
else else
{ {
do { do {
...@@ -1019,13 +1019,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) ...@@ -1019,13 +1019,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
if (str) break; if (str) break;
str = "Unspecified description"; str = "Unspecified description";
} while (0); } 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 */ /* stream URL */
if (mountinfo && mountinfo->stream_url) if (mountinfo && mountinfo->stream_url)
str = mountinfo->stream_url; stats_event (source->mount, "server_url", mountinfo->stream_url);
else else
{ {
do { do {
...@@ -1036,13 +1036,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) ...@@ -1036,13 +1036,13 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
str = httpp_getvar (parser, "x-audiocast-url"); str = httpp_getvar (parser, "x-audiocast-url");
if (str) break; if (str) break;
} while (0); } 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 */ /* stream genre */
if (mountinfo && mountinfo->stream_genre) if (mountinfo && mountinfo->stream_genre)
str = mountinfo->stream_genre; stats_event (source->mount, "genre", mountinfo->stream_genre);
else else
{ {
do { do {
...@@ -1054,9 +1054,9 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) ...@@ -1054,9 +1054,9 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
if (str) break; if (str) break;
str = "various"; str = "various";
} while (0); } 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 */ /* stream bitrate */
if (mountinfo && mountinfo->bitrate) if (mountinfo && mountinfo->bitrate)
......
...@@ -316,10 +316,19 @@ static int send_to_yp (const char *cmd, ypdata_t *yp, char *post) ...@@ -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); ERROR3 ("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
yp->next_update += 7200; 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); INFO3 ("YP %s on %s failed: %s", cmd, server->url, yp->error_msg);
yp->next_update += 1200;
} }
yp->process = do_yp_add; yp->process = do_yp_add;
free (yp->sid); free (yp->sid);
...@@ -904,9 +913,18 @@ void yp_remove (const char *mount) ...@@ -904,9 +913,18 @@ void yp_remove (const char *mount)
thread_rwlock_rlock (&yp_lock); thread_rwlock_rlock (&yp_lock);
while (server) while (server)
{ {
ypdata_t *yp = find_yp_mount (server->mounts, mount); ypdata_t *list = server->mounts;
if (yp)
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); DEBUG2 ("release %s on YP %s", mount, server->url);
yp->release = 1; yp->release = 1;
yp->next_update = 0; yp->next_update = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment