Handle not being able to connect using IPv6 if the host does not support it.
This commit is contained in:
parent
d1ad31696e
commit
c9093c9972
@ -464,9 +464,15 @@ class XMLStream(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
af = Socket.AF_INET
|
af = Socket.AF_INET
|
||||||
|
proto = 'IPv4'
|
||||||
if ':' in self.address[0]:
|
if ':' in self.address[0]:
|
||||||
af = Socket.AF_INET6
|
af = Socket.AF_INET6
|
||||||
|
proto = 'IPv6'
|
||||||
|
try:
|
||||||
self.socket = self.socket_class(af, Socket.SOCK_STREAM)
|
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()
|
self.configure_socket()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user