mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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:
parent
7d967712b8
commit
600232b562
3 changed files with 27 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue