[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - client.py:1.14
Guido van Rossum
guido@python.org
Tue, 17 Sep 2002 11:44:55 -0400
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv13653
Modified Files:
client.py
Log Message:
Rip out superstitious Winsock-specific code. It doesn't seem to make
any difference on Win2k. Add XXX comment with question about
WSAEALREADY.
=== ZODB3/ZEO/zrpc/client.py 1.13 => 1.14 ===
--- ZODB3/ZEO/zrpc/client.py:1.13 Fri Sep 13 17:11:02 2002
+++ ZODB3/ZEO/zrpc/client.py Tue Sep 17 11:44:55 2002
@@ -188,6 +188,9 @@
# to the errno value(s) expected if the connect succeeds *or* if it's
# already connected (our code can attempt redundant connects).
if hasattr(errno, "WSAEWOULDBLOCK"): # Windows
+ # XXX The official Winsock docs claim that WSAEALREADY should be
+ # treated as yet another "in progress" indicator, but we've never
+ # seen this.
_CONNECT_IN_PROGRESS = (errno.WSAEWOULDBLOCK,)
# Win98: WSAEISCONN; Win2K: WSAEINVAL
_CONNECT_OK = (0, errno.WSAEISCONN, errno.WSAEINVAL)
@@ -327,8 +330,6 @@
assert not wrappers
return 0
-_USING_WINSOCK = sys.platform.startswith("win")
-
class ConnectWrapper:
"""An object that handles the connection procedure for one socket.
@@ -385,33 +386,9 @@
level=zLOG.WARNING)
self.close()
return
- if err == 0 and _USING_WINSOCK:
- self.winsock_check_connected()
- else:
- self.state = "connected"
+ self.state = "connected"
if self.state == "connected":
self.test_connection()
-
- def winsock_check_connected(self):
- """Deal with winsock oddities.
-
- XXX How much of this is superstition?
-
- It appears that winsock isn't behaving as expected on Win2k.
- It's possible for connect_ex() to return 0, but the connection
- to have failed. In particular, in situations where I expect
- to get a Connection refused (10061), I'm seeing connect_ex()
- return 0. OTOH, it looks like select() is a more reliable
- indicator on Windows.
- """
- # XXX Why not use 0.0 as timeout?
- r, w, x = select.select([self.sock], [self.sock], [self.sock], 0.1)
- if not (r or w or x):
- self.state = "connecting"
- elif x:
- self.close()
- else:
- self.state = "connected"
def test_connection(self):
"""Establish and test a connection at the zrpc level.