From: Wouter Wijngaards Date: Mon, 23 Nov 2009 12:12:59 +0000 (+0000) Subject: fixup spinning X-Git-Tag: release-1.4.0^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=039f276b0ce92a3f71f80b5d9bdde9d4558da2b7;p=thirdparty%2Funbound.git fixup spinning git-svn-id: file:///svn/unbound/trunk@1919 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/remote.c b/daemon/remote.c index 8f00a5440..3c0cb2e67 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -106,9 +106,9 @@ timeval_subtract(struct timeval* d, const struct timeval* end, const struct timeval* start) { #ifndef S_SPLINT_S - time_t end_usec = end->tv_usec;; + time_t end_usec = end->tv_usec; d->tv_sec = end->tv_sec - start->tv_sec; - while(end_usec < start->tv_usec) { + if(end_usec < start->tv_usec) { end_usec += 1000000; d->tv_sec--; } diff --git a/daemon/stats.c b/daemon/stats.c index 8dfc08ac2..2e0ebcd88 100644 --- a/daemon/stats.c +++ b/daemon/stats.c @@ -58,7 +58,7 @@ timeval_add(struct timeval* d, const struct timeval* add) #ifndef S_SPLINT_S d->tv_sec += add->tv_sec; d->tv_usec += add->tv_usec; - while(d->tv_usec > 1000000 ) { + if(d->tv_usec > 1000000) { d->tv_usec -= 1000000; d->tv_sec++; } diff --git a/doc/Changelog b/doc/Changelog index 506f2c985..0935b2148 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,7 @@ 23 November 2009: Wouter - Patch from David Hubbard for libunbound manual page. + - Fixup endless spinning in unbound-control stats reported by + Attila Nagy. Probably caused by clock reversal. 20 November 2009: Wouter - contrib/split-itar.sh contributed by Tom Hendrikx. diff --git a/services/mesh.c b/services/mesh.c index cc199d0da..2169b4236 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -61,9 +61,9 @@ static void timeval_subtract(struct timeval* d, const struct timeval* end, const struct timeval* start) { #ifndef S_SPLINT_S - time_t end_usec = end->tv_usec;; + time_t end_usec = end->tv_usec; d->tv_sec = end->tv_sec - start->tv_sec; - while(end_usec < start->tv_usec) { + if(end_usec < start->tv_usec) { end_usec += 1000000; d->tv_sec--; } @@ -78,7 +78,7 @@ timeval_add(struct timeval* d, const struct timeval* add) #ifndef S_SPLINT_S d->tv_sec += add->tv_sec; d->tv_usec += add->tv_usec; - while(d->tv_usec > 1000000 ) { + if(d->tv_usec > 1000000 ) { d->tv_usec -= 1000000; d->tv_sec++; } diff --git a/testcode/fake_event.c b/testcode/fake_event.c index ef44ab7ba..29135c410 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -71,7 +71,7 @@ timeval_add(struct timeval* d, const struct timeval* add) #ifndef S_SPLINT_S d->tv_sec += add->tv_sec; d->tv_usec += add->tv_usec; - while(d->tv_usec > 1000000 ) { + if(d->tv_usec > 1000000) { d->tv_usec -= 1000000; d->tv_sec++; }