mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Fix handling of DNS exceptions.
This commit is contained in:
parent
ede59ab40e
commit
84f9505a8d
1 changed files with 4 additions and 2 deletions
|
@ -673,11 +673,13 @@ class XMLStream(object):
|
||||||
answers = dns.resolver.query(domain, dns.rdatatype.A)
|
answers = dns.resolver.query(domain, dns.rdatatype.A)
|
||||||
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
||||||
log.warning("No A records for %s" % domain)
|
log.warning("No A records for %s" % domain)
|
||||||
|
return [((domain, port), 0, 0)]
|
||||||
except dns.exception.Timeout:
|
except dns.exception.Timeout:
|
||||||
log.warning("DNS resolution timed out " + \
|
log.warning("DNS resolution timed out " + \
|
||||||
"for A record of %s" % domain)
|
"for A record of %s" % domain)
|
||||||
answers = [((answer.address, port), 0, 0) for answer in answers]
|
return [((domain, port), 0, 0)]
|
||||||
return answers
|
else:
|
||||||
|
return [((ans.address, port), 0, 0) for ans in answers]
|
||||||
else:
|
else:
|
||||||
log.warning("dnspython is not installed -- " + \
|
log.warning("dnspython is not installed -- " + \
|
||||||
"relying on OS A record resolution")
|
"relying on OS A record resolution")
|
||||||
|
|
Loading…
Reference in a new issue