From: Bob Halley Date: Wed, 17 Jun 2020 18:39:17 +0000 (-0700) Subject: Treat OSErrors during resolution as permanent failures, in line with other X-Git-Tag: v2.0.0rc1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ed1648b8427e77b1f21d1896ca8aaff11598e74;p=thirdparty%2Fdnspython.git Treat OSErrors during resolution as permanent failures, in line with other stub resolvers. Reduce default lifetime from 30 seconds to 5 seconds. --- diff --git a/dns/resolver.py b/dns/resolver.py index 53ef68d3..272db86a 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -616,6 +616,7 @@ class _Resolution: ex, response)) if isinstance(ex, dns.exception.FormError) or \ isinstance(ex, EOFError) or \ + isinstance(ex, OSError) or \ isinstance(ex, NotImplementedError): # This nameserver is no good, take it out of the mix. self.nameservers.remove(self.nameserver) @@ -658,8 +659,7 @@ class _Resolution: else: # # We got a response, but we're not happy with the - # rcode in it. Remove the server from the mix if - # the rcode isn't SERVFAIL. + # rcode in it. # if rcode != dns.rcode.SERVFAIL or not self.resolver.retry_servfail: self.nameservers.remove(self.nameserver) @@ -706,7 +706,7 @@ class Resolver: self.search = [] self.use_search_by_default = False self.timeout = 2.0 - self.lifetime = 30.0 + self.lifetime = 5.0 self.keyring = None self.keyname = None self.keyalgorithm = dns.tsig.default_algorithm