Commit 90d15055 authored by Tres Seaver's avatar Tres Seaver

Fix connecting to 'localhost' on Windows / Solaris / Android.

Closes #8.

Closes #30.
parent 1bd6bd93
Changelog Changelog
========= =========
4.2.1 (unreleased)
------------------
- Fix bug connecting to ``localhost`` on Windows. (#8).
4.2.0 (2016-06-15) 4.2.0 (2016-06-15)
------------------ ------------------
......
...@@ -452,12 +452,10 @@ class ConnectThread(threading.Thread): ...@@ -452,12 +452,10 @@ class ConnectThread(threading.Thread):
if domain == socket.AF_INET: if domain == socket.AF_INET:
host, port = addr host, port = addr
for (family, socktype, proto, cannoname, sockaddr for (family, socktype, proto, cannoname, sockaddr
) in socket.getaddrinfo(host or 'localhost', port): ) in socket.getaddrinfo(host or 'localhost', port,
# we only speak TCP, so let's skip UDP and RAW sockets socket.AF_INET,
# otherwise we'll try to connect to the same address socket.SOCK_STREAM
# three times in a row ): # prune non-TCP results
if socktype != socket.SOCK_STREAM:
continue
# for IPv6, drop flowinfo, and restrict addresses # for IPv6, drop flowinfo, and restrict addresses
# to [host]:port # to [host]:port
yield family, sockaddr[:2] yield family, sockaddr[:2]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment