From: Wouter Wijngaards Date: Wed, 30 Nov 2011 13:39:11 +0000 (+0000) Subject: - Fix for tcp-upstream and ssl-upstream for if a laptop sleeps, X-Git-Tag: release-1.4.14rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35172e89f4610b6cb6a70a515c8f91078581f6b0;p=thirdparty%2Funbound.git - Fix for tcp-upstream and ssl-upstream for if a laptop sleeps, causes SERVFAILs. Also fixed for UDP (but less likely). git-svn-id: file:///svn/unbound/trunk@2559 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index fdcb23868..d3959d22f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +30 November 2011: Wouter + - Fix for tcp-upstream and ssl-upstream for if a laptop sleeps, causes + SERVFAILs. Also fixed for UDP (but less likely). + 28 November 2011: Wouter - Fix quartile time estimate, it was too low, (thanks Jan Komissar). - iana ports updated. diff --git a/services/outside_network.c b/services/outside_network.c index ba0f8feab..fef3c002f 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -1562,10 +1562,14 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, + ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000; verbose(VERB_ALGO, "measured TCP-time at %d msec", roundtime); log_assert(roundtime >= 0); - if(!infra_rtt_update(sq->outnet->infra, &sq->addr, sq->addrlen, - sq->zone, sq->zonelen, roundtime, sq->last_rtt, - (uint32_t)now.tv_sec)) + /* only store if less then AUTH_TIMEOUT seconds, it could be + * huge due to system-hibernated and we woke up */ + if(roundtime < TCP_AUTH_QUERY_TIMEOUT*1000) { + if(!infra_rtt_update(sq->outnet->infra, &sq->addr, + sq->addrlen, sq->zone, sq->zonelen, roundtime, + sq->last_rtt, (uint32_t)now.tv_sec)) log_err("out of memory noting rtt."); + } } } /* insert address into reply info */ @@ -1744,10 +1748,14 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, + ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000; verbose(VERB_ALGO, "measured roundtrip at %d msec", roundtime); log_assert(roundtime >= 0); - if(!infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen, + /* in case the system hibernated, do not enter a huge value, + * above this value gives trouble with server selection */ + if(roundtime < 60000) { + if(!infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen, sq->zone, sq->zonelen, roundtime, sq->last_rtt, (uint32_t)now.tv_sec)) log_err("out of memory noting rtt."); + } } } /* end of if_!fallback_tcp */ /* perform TC flag check and TCP fallback after updating our