summaryrefslogtreecommitdiff
path: root/dns/resolver.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-06-17 11:39:17 -0700
committerBob Halley <halley@dnspython.org>2020-06-17 12:04:13 -0700
commit7ed1648b8427e77b1f21d1896ca8aaff11598e74 (patch)
treef8daf72bbf64f42c849b9e30d40696a81de9c246 /dns/resolver.py
parent0bbca68e277f6dbcf0d7d6df1bdf28f4f2124f85 (diff)
downloaddnspython-7ed1648b8427e77b1f21d1896ca8aaff11598e74.tar.gz
Treat OSErrors during resolution as permanent failures, in line with other
stub resolvers. Reduce default lifetime from 30 seconds to 5 seconds.
Diffstat (limited to 'dns/resolver.py')
-rw-r--r--dns/resolver.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/dns/resolver.py b/dns/resolver.py
index 53ef68d..272db86 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