summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-08-24 22:40:57 -0700
committerLance Stout <lancestout@gmail.com>2011-08-24 22:40:57 -0700
commit84f9505a8d23a21005ea72a040e955124dd3c240 (patch)
tree96997352c669f46ebfdf05f05043388dde219707 /sleekxmpp
parentede59ab40e896293adba1278c42463fd8a5ba0fa (diff)
downloadslixmpp-84f9505a8d23a21005ea72a040e955124dd3c240.tar.gz
slixmpp-84f9505a8d23a21005ea72a040e955124dd3c240.tar.bz2
slixmpp-84f9505a8d23a21005ea72a040e955124dd3c240.tar.xz
slixmpp-84f9505a8d23a21005ea72a040e955124dd3c240.zip
Fix handling of DNS exceptions.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 19147690..061c2951 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -673,11 +673,13 @@ class XMLStream(object):
answers = dns.resolver.query(domain, dns.rdatatype.A)
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
log.warning("No A records for %s" % domain)
+ return [((domain, port), 0, 0)]
except dns.exception.Timeout:
log.warning("DNS resolution timed out " + \
"for A record of %s" % domain)
- answers = [((answer.address, port), 0, 0) for answer in answers]
- return answers
+ return [((domain, port), 0, 0)]
+ else:
+ return [((ans.address, port), 0, 0) for ans in answers]
else:
log.warning("dnspython is not installed -- " + \
"relying on OS A record resolution")