From: Wouter Wijngaards Date: Wed, 27 Oct 2010 08:09:22 +0000 (+0000) Subject: nicer output from debug commands X-Git-Tag: release-1.4.7rc1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=758a42643abc36ab643edd2c3fe242bb5e7dc8d5;p=thirdparty%2Funbound.git nicer output from debug commands git-svn-id: file:///svn/unbound/trunk@2314 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/cachedump.c b/daemon/cachedump.c index 85fe9f839..242931a09 100644 --- a/daemon/cachedump.c +++ b/daemon/cachedump.c @@ -816,7 +816,12 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp) /* lookup in infra cache */ entry_ttl = infra_get_host_rto(worker->env.infra_cache, &a->addr, a->addrlen, &ri, &delay, *worker->env.now); - if(entry_ttl == -1) { + if(entry_ttl == -2 && ri.rto >= USEFUL_SERVER_TOP_TIMEOUT) { + if(!ssl_printf(ssl, "expired, rto %d msec.\n", ri.rto)) + return; + continue; + } + if(entry_ttl == -1 || entry_ttl == -2) { if(!ssl_printf(ssl, "not in infra cache.\n")) return; continue; /* skip stuff not in infra cache */ diff --git a/daemon/remote.c b/daemon/remote.c index f78e1d632..fb79722ef 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -1567,6 +1567,10 @@ dump_infra_host(struct lruhash_entry* e, void* arg) a->ipstr = ip_str; /* skip expired stuff (only backed off) */ if(d->ttl < a->now) { + if(d->rtt.rto >= USEFUL_SERVER_TOP_TIMEOUT) { + if(!ssl_printf(a->ssl, "%s expired rto %d\n", ip_str, + d->rtt.rto)) return; + } if(d->lameness) lruhash_traverse(d->lameness, 0, &dump_infra_lame, arg); return; diff --git a/services/cache/infra.c b/services/cache/infra.c index d6b542308..ba02b5083 100644 --- a/services/cache/infra.c +++ b/services/cache/infra.c @@ -542,7 +542,7 @@ int infra_get_host_rto(struct infra_cache* infra, struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr, addrlen, 0); struct infra_host_data* data; - int ttl = -1; + int ttl = -2; if(!e) return -1; data = (struct infra_host_data*)e->data; if(data->ttl >= timenow) { @@ -640,6 +640,8 @@ infra_get_lame_rtt(struct infra_cache* infra, if(timenow > host->ttl) { /* expired entry */ /* see if this can be a re-probe of an unresponsive server */ + /* minus 1000 because that is outside of the RTTBAND, so + * blacklisted servers stay blacklisted if this is chosen */ if(host->rtt.rto >= USEFUL_SERVER_TOP_TIMEOUT) { *rtt = USEFUL_SERVER_TOP_TIMEOUT-1000; lock_rw_unlock(&e->lock); diff --git a/services/cache/infra.h b/services/cache/infra.h index 376e1ae50..3d7f986f2 100644 --- a/services/cache/infra.h +++ b/services/cache/infra.h @@ -299,6 +299,7 @@ int infra_get_lame_rtt(struct infra_cache* infra, * @param delay: probe delay (if any). * @param timenow: what time it is now. * @return TTL the infra host element is valid for. If -1: not found in cache. + * TTL -2: found but expired. */ int infra_get_host_rto(struct infra_cache* infra, struct sockaddr_storage* addr, socklen_t addrlen,