[Python-checkins] python/dist/src/Lib/test test_socket.py,1.34,1.35
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Thu, 13 Jun 2002 09:07:06 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv17318/Lib/test
Modified Files:
test_socket.py
Log Message:
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).
Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** test_socket.py 13 Jun 2002 15:07:43 -0000 1.34
--- test_socket.py 13 Jun 2002 16:07:03 -0000 1.35
***************
*** 417,432 ****
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.")
def testRecv(self):
--- 417,422 ----
def _testConnect(self):
! self.cli.settimeout(10)
! self.cli.connect((HOST, PORT))
def testRecv(self):