summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/resolver.py
diff options
context:
space:
mode:
authorAlexander Shorin <kxepal@gmail.com>2013-07-29 14:21:46 +0400
committerAlexander Shorin <kxepal@gmail.com>2013-07-29 14:21:46 +0400
commit556e4bd74d3536fd951acaa410b89a2e81de7d54 (patch)
tree255fe9993bf884e2eca1f820d6a062f97bbcb4de /sleekxmpp/xmlstream/resolver.py
parentd439c4f21515813b69f8e39d430cee8ca9a3c946 (diff)
downloadslixmpp-556e4bd74d3536fd951acaa410b89a2e81de7d54.tar.gz
slixmpp-556e4bd74d3536fd951acaa410b89a2e81de7d54.tar.bz2
slixmpp-556e4bd74d3536fd951acaa410b89a2e81de7d54.tar.xz
slixmpp-556e4bd74d3536fd951acaa410b89a2e81de7d54.zip
Don't resolve AAAA records if there is no dnspython nor IPv6 support
If system doesn't has IPv6 support or dnspython package, socket.getaddrinfo with AF_INET6 flag return weird IP info for requested host, making SleekXMPP crush with more weird error.
Diffstat (limited to 'sleekxmpp/xmlstream/resolver.py')
-rw-r--r--sleekxmpp/xmlstream/resolver.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/sleekxmpp/xmlstream/resolver.py b/sleekxmpp/xmlstream/resolver.py
index 4cac254c..6f26797f 100644
--- a/sleekxmpp/xmlstream/resolver.py
+++ b/sleekxmpp/xmlstream/resolver.py
@@ -202,6 +202,9 @@ def get_AAAA(host, resolver=None):
# If not using dnspython, attempt lookup using the OS level
# getaddrinfo() method.
if resolver is None:
+ if not socket.has_ipv6:
+ log.debug("Unable to query %s for AAAA records: IPv6 is not supported", host)
+ return []
try:
recs = socket.getaddrinfo(host, None, socket.AF_INET6,
socket.SOCK_STREAM)