diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-30 11:48:12 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-11-30 11:48:12 -0500 |
commit | 766d0a2d98591ed840cce42710c5a59a2e7dc731 (patch) | |
tree | 3addec468ff5c739124d2b88c8ddfa129eae85e3 /src/or | |
parent | b1c4ab0bec5b2b07e7e5358f449e352bb34c75d0 (diff) | |
parent | 072e194a15e9aa0e75c6723763a69476f4f31b93 (diff) | |
download | tor-766d0a2d98591ed840cce42710c5a59a2e7dc731.tar.gz tor-766d0a2d98591ed840cce42710c5a59a2e7dc731.zip |
Merge branch 'maint-0.2.9' into maint-0.3.0
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dns.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index 6c0a8a8ac7..ed20836aed 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -1425,14 +1425,31 @@ configure_nameservers(int force) #define SET(k,v) evdns_base_set_option(the_evdns_base, (k), (v)) + // If we only have one nameserver, it does not make sense to back off + // from it for a timeout. Unfortunately, the value for max-timeouts is + // currently clamped by libevent to 255, but it does not hurt to set + // it higher in case libevent gets a patch for this. + // Reducing attempts in the case of just one name server too, because + // it is very likely to be a local one where a network connectivity + // issue should not cause an attempt to fail. if (evdns_base_count_nameservers(the_evdns_base) == 1) { - SET("max-timeouts:", "16"); - SET("timeout:", "10"); + SET("max-timeouts:", "1000000"); + SET("attempts:", "1"); } else { SET("max-timeouts:", "3"); - SET("timeout:", "5"); } + // Elongate the queue of maximum inflight dns requests, so if a bunch + // time out at the resolver (happens commonly with unbound) we won't + // stall every other DNS request. This potentially means some wasted + // CPU as there's a walk over a linear queue involved, but this is a + // much better tradeoff compared to just failing DNS requests because + // of a full queue. + SET("max-inflight:", "8192"); + + // Time out after 5 seconds if no reply. + SET("timeout:", "5"); + if (options->ServerDNSRandomizeCase) SET("randomize-case:", "1"); else |