]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix for tcp-upstream and ssl-upstream for if a laptop sleeps,
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 30 Nov 2011 13:39:11 +0000 (13:39 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 30 Nov 2011 13:39:11 +0000 (13:39 +0000)
causes SERVFAILs.  Also fixed for UDP (but less likely).

git-svn-id: file:///svn/unbound/trunk@2559 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/outside_network.c

index fdcb23868afbd1228cdffc34e95fffe46bb6ad3d..d3959d22f2dbd61c9f77b450f3285f7dac56ef30 100644 (file)
@@ -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.
index ba0f8feabfa7729b2f9925be2169a1f47e2e6a6d..fef3c002fd09d80e52e9fb9532044400120e2004 100644 (file)
@@ -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