summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-05-27 16:33:21 -0700
committerLance Stout <lancestout@gmail.com>2012-05-27 16:33:21 -0700
commitc9093c9972efad667a95296366c45e7aa2142966 (patch)
tree028a628e5657abec3157581f5408f8c55b5b8b0e
parentd1ad31696e9c59cbb7389317585e2d1a7a397e94 (diff)
downloadslixmpp-c9093c9972efad667a95296366c45e7aa2142966.tar.gz
slixmpp-c9093c9972efad667a95296366c45e7aa2142966.tar.bz2
slixmpp-c9093c9972efad667a95296366c45e7aa2142966.tar.xz
slixmpp-c9093c9972efad667a95296366c45e7aa2142966.zip
Handle not being able to connect using IPv6 if the host does not support it.
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 56177556..d12e29b3 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -464,9 +464,15 @@ class XMLStream(object):
return False
af = Socket.AF_INET
+ proto = 'IPv4'
if ':' in self.address[0]:
af = Socket.AF_INET6
- self.socket = self.socket_class(af, Socket.SOCK_STREAM)
+ proto = 'IPv6'
+ try:
+ self.socket = self.socket_class(af, Socket.SOCK_STREAM)
+ except Socket.error:
+ log.debug("Could not connect using %s", proto)
+ return False
self.configure_socket()