diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-05 21:03:42 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-05 21:03:42 (GMT) |
commit | 600232b562391d62f33dcc19c09eb9c3e9190c46 (patch) | |
tree | 37871d8858bf75a0e98bf602be889775e5048a31 /Lib/test/test_socket.py | |
parent | 7d967712b8cc35b4cc33c1a7be14ddc9baba2c97 (diff) | |
download | cpython-600232b562391d62f33dcc19c09eb9c3e9190c46.zip cpython-600232b562391d62f33dcc19c09eb9c3e9190c46.tar.gz cpython-600232b562391d62f33dcc19c09eb9c3e9190c46.tar.bz2 |
Issue #7995: When calling accept() on a socket with a timeout, the returned
socket is now always non-blocking, regardless of the operating system.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 8f96fe4..23d22a8 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -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) |