Issue #7995: When calling accept() on a socket with a timeout, the returned

socket is now always non-blocking, regardless of the operating system.
This commit is contained in:
Antoine Pitrou 2011-01-05 21:03:42 +00:00
parent 7d967712b8
commit 600232b562
3 changed files with 27 additions and 1 deletions

View file

@ -982,6 +982,23 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
def _testInitNonBlocking(self):
pass
def testInheritFlags(self):
# Issue #7995: when calling accept() on a listening socket with a
# timeout, the resulting socket should not be non-blocking.
self.serv.settimeout(10)
try:
conn, addr = self.serv.accept()
message = conn.recv(len(MSG))
finally:
conn.close()
self.serv.settimeout(None)
def _testInheritFlags(self):
time.sleep(0.1)
self.cli.connect((HOST, self.port))
time.sleep(0.5)
self.cli.send(MSG)
def testAccept(self):
# Testing non-blocking accept
self.serv.setblocking(0)