From 959088280fc70d1de06dcaabfdfe37691aab2761 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 27 Jun 2007 13:26:32 +0000 Subject: [PATCH] Do not select servers that are known to not give replies. git-svn-id: file:///svn/unbound/trunk@427 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 5 +++++ iterator/iter_utils.c | 6 ++++-- iterator/iterator.h | 9 ++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index f14af3928..854de32c7 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,11 @@ - delete of mesh does a postorder traverse of the tree. - found and fixed a memory leak. For TTL=0 messages, that would not be cached, instead the msg-replyinfo structure was leaked. + - changed server selection so it will filter out hosts that are + unresponsive. This is defined as a host with the maximum rto value. + This means that unbound tried the host for retries up to 120 secs. + The rto value will time out after host-ttl seconds from the cache. + This keeps such unresolvable queries from taking up resources. 26 June 2007: Wouter - mesh is called by worker, and iterator uses it. diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index df3decd79..2c9da2188 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -161,8 +161,10 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env, if(infra_get_lame_rtt(env->infra_cache, &a->addr, a->addrlen, name, namelen, &lame, &rtt, now)) { if(lame) - return -1; - else return rtt; + return -1; /* server is lame */ + else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT) + return -1; /* server is unresponsive */ + else return rtt; } /* no server information present */ return UNKNOWN_SERVER_NICENESS; diff --git a/iterator/iterator.h b/iterator/iterator.h index 0c6729d41..ba9996695 100644 --- a/iterator/iterator.h +++ b/iterator/iterator.h @@ -53,8 +53,15 @@ struct iter_prep_list; #define MAX_RESTART_COUNT 8 /** max number of referrals. Makes sure resolver does not run away */ #define MAX_REFERRAL_COUNT 30 -/** how nice is a server without further information, in msec */ +/** how nice is a server without further information, in msec + * Equals rtt initial timeout value. + */ #define UNKNOWN_SERVER_NICENESS 3000 +/** maximum timeout before a host is deemed unsuitable, in msec. + * After host_ttl this will be timed out and the host will be tried again. + * Equals RTT_MAX_TIMEOUT + */ +#define USEFUL_SERVER_TOP_TIMEOUT 120000 /** * Global state for the iterator. -- 2.47.2