From bded7d25647e45450d51045a3513164715399947 Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Sat, 19 Apr 2008 02:04:17 +0000 Subject: [PATCH] Small cleanups. Prevent possible segv in relay definition if missing server tag. Don't add to stream directory until a minute has passed, it seems like a few sites are triggering YP requests because they are connecting and then dropping (probably due to timeout), so at least make sure the stream is running a little while. svn path=/icecast/trunk/icecast/; revision=14777 --- conf/icecast.xml.in | 12 ++++++------ configure.in | 2 ++ src/cfgfile.c | 1 + src/yp.c | 7 +++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/conf/icecast.xml.in b/conf/icecast.xml.in index 040acf9e..4e50a9e5 100644 --- a/conf/icecast.xml.in +++ b/conf/icecast.xml.in @@ -31,6 +31,12 @@ hackme + + - @pkgdatadir@ diff --git a/configure.in b/configure.in index f98189bb..103a7754 100644 --- a/configure.in +++ b/configure.in @@ -31,12 +31,14 @@ dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC +AC_HEADER_TIME AC_CHECK_HEADERS([alloca.h]) AC_CHECK_HEADERS(pwd.h, AC_DEFINE(CHUID, 1, [Define if you have pwd.h]),,) AC_CHECK_HEADERS(unistd.h, AC_DEFINE(CHROOT, 1, [Define if you have unistd.h]),,) dnl Checks for typedefs, structures, and compiler characteristics. +XIPH_C__FUNC__ dnl Check for types diff --git a/src/cfgfile.c b/src/cfgfile.c index 55086e07..0c25ed3c 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -728,6 +728,7 @@ static void _parse_relay(xmlDocPtr doc, xmlNodePtr node, relay->next = NULL; relay->mp3metadata = 1; relay->on_demand = configuration->on_demand; + relay->server = (char *)xmlCharStrdup ("127.0.0.1"); relay->mount = (char *)xmlCharStrdup ("/"); do { diff --git a/src/yp.c b/src/yp.c index 9579256d..ffe75035 100644 --- a/src/yp.c +++ b/src/yp.c @@ -406,7 +406,6 @@ static int do_yp_add (ypdata_t *yp, char *s, unsigned len) /* force first touch in 5 secs */ yp->next_update = time(NULL) + 5; } - return ret; } @@ -480,7 +479,7 @@ static int do_yp_touch (ypdata_t *yp, char *s, unsigned len) static int process_ypdata (struct yp_server *server, ypdata_t *yp) { - unsigned len = 512; + unsigned len = 1024; char *s = NULL, *tmp; if (now < yp->next_update) @@ -501,7 +500,7 @@ static int process_ypdata (struct yp_server *server, ypdata_t *yp) } ret = yp->process (yp, s, len); - if (ret == 0) + if (ret <= 0) { free (s); return ret; @@ -882,7 +881,7 @@ void yp_add (const char *mount) yp->server = server; yp->touch_interval = server->touch_interval; yp->next = server->pending_mounts; - yp->next_update = time(NULL) + 5; + yp->next_update = time(NULL) + 60; server->pending_mounts = yp; yp_update = 1; }