Commit 332dcf54 authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Merge pull request #31 from zopefoundation/8-windows_sock_stream

Fix connecting to 'localhost' on Windows / Solaris / Android.
parents a7a5fab7 90d15055
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)
------------------ ------------------
......
...@@ -29,7 +29,6 @@ from ZEO.zrpc.error import DisconnectedError ...@@ -29,7 +29,6 @@ from ZEO.zrpc.error import DisconnectedError
from ZODB.POSException import ReadOnlyError from ZODB.POSException import ReadOnlyError
from ZODB.loglevels import BLATHER from ZODB.loglevels import BLATHER
from six.moves import map from six.moves import map
from six.moves import zip
def client_timeout(): def client_timeout():
...@@ -453,12 +452,10 @@ class ConnectThread(threading.Thread): ...@@ -453,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