bug 363163: copy the SSHClient AF patch to transport.py too.
This commit is contained in:
parent
d23ae79466
commit
e80cec73b6
|
@ -273,9 +273,8 @@ class SSHClient (object):
|
|||
establishing an SSH session
|
||||
@raise socket.error: if a socket error occurred while connecting
|
||||
"""
|
||||
for (family, socktype, proto, canonname, sockaddr) in \
|
||||
socket.getaddrinfo(hostname, port):
|
||||
if socktype==socket.SOCK_STREAM:
|
||||
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port):
|
||||
if socktype == socket.SOCK_STREAM:
|
||||
af = family
|
||||
addr = sockaddr
|
||||
break
|
||||
|
|
|
@ -285,7 +285,14 @@ class Transport (threading.Thread):
|
|||
if type(sock) is tuple:
|
||||
# connect to the given (host, port)
|
||||
hostname, port = sock
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port):
|
||||
if socktype == socket.SOCK_STREAM:
|
||||
af = family
|
||||
addr = sockaddr
|
||||
break
|
||||
else:
|
||||
raise SSHException('No suitable address family for %s' % hostname)
|
||||
sock = socket.socket(af, socket.SOCK_STREAM)
|
||||
sock.connect((hostname, port))
|
||||
# okay, normal socket-ish flow here...
|
||||
threading.Thread.__init__(self)
|
||||
|
|
Loading…
Reference in New Issue