diff options
author | Guido van Rossum <guido@python.org> | 2002-06-13 16:07:04 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-06-13 16:07:04 (GMT) |
commit | 7b8bac106aaddc6d9d438309f06cd3a51e701753 (patch) | |
tree | 55bc7dcf1d053c7bb25edf3d712573f9b83a4493 /Lib | |
parent | 129b17d538ddb5fa4df2d2d8ec1876d9a9ea4355 (diff) | |
download | cpython-7b8bac106aaddc6d9d438309f06cd3a51e701753.zip cpython-7b8bac106aaddc6d9d438309f06cd3a51e701753.tar.gz cpython-7b8bac106aaddc6d9d438309f06cd3a51e701753.tar.bz2 |
Fix non-blocking connect() for Windows. Refactored the code
that retries the connect() call in timeout mode so it can be shared
between connect() and connect_ex(), and needs only a single #ifdef.
The test for this was doing funky stuff I don't approve of,
so I removed it in favor of a simpler test. This allowed me
to implement a simpler, "purer" form of the timeout retry code.
Hopefully that's enough (if you want to be fancy, use non-blocking
mode and decode the errors yourself, like before).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_socket.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 485e038..a2db64a 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -416,18 +416,8 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest): conn, addr = self.serv.accept() def _testConnect(self): - self.cli.setblocking(0) - try: - self.cli.connect((HOST, PORT)) - except socket.error: - pass - else: - self.fail("Error trying to do non-blocking connect.") - read, write, err = select.select([self.cli], [], []) - if self.cli in read: - self.cli.connect((HOST, PORT)) - else: - self.fail("Error trying to do connect after select.") + self.cli.settimeout(10) + self.cli.connect((HOST, PORT)) def testRecv(self): """Testing non-blocking recv.""" |