diff options
author | Charles-François Natali <cf.natali@gmail.com> | 2014-07-23 18:28:13 (GMT) |
---|---|---|
committer | Charles-François Natali <cf.natali@gmail.com> | 2014-07-23 18:28:13 (GMT) |
commit | 6e20460dc6356d213e816bbbd8dc6a336c83bbd0 (patch) | |
tree | 03871af1970c99a2ec09229730dac0cce4053586 /Lib | |
parent | 8518b79a8d13920c06a5cdccd255944f2187f62f (diff) | |
download | cpython-6e20460dc6356d213e816bbbd8dc6a336c83bbd0.zip cpython-6e20460dc6356d213e816bbbd8dc6a336c83bbd0.tar.gz cpython-6e20460dc6356d213e816bbbd8dc6a336c83bbd0.tar.bz2 |
Issue #21566: Make use of socket.listen() default backlog.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/multiprocessing/forkserver.py | 2 | ||||
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 4 | ||||
-rw-r--r-- | Lib/test/test_asynchat.py | 2 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 2 | ||||
-rw-r--r-- | Lib/test/test_asyncore.py | 2 | ||||
-rw-r--r-- | Lib/test/test_epoll.py | 2 | ||||
-rw-r--r-- | Lib/test/test_ftplib.py | 6 | ||||
-rw-r--r-- | Lib/test/test_httplib.py | 4 | ||||
-rw-r--r-- | Lib/test/test_kqueue.py | 2 | ||||
-rw-r--r-- | Lib/test/test_poplib.py | 2 | ||||
-rw-r--r-- | Lib/test/test_selectors.py | 2 | ||||
-rw-r--r-- | Lib/test/test_smtplib.py | 2 | ||||
-rw-r--r-- | Lib/test/test_socket.py | 10 | ||||
-rw-r--r-- | Lib/test/test_ssl.py | 10 | ||||
-rw-r--r-- | Lib/test/test_support.py | 2 | ||||
-rw-r--r-- | Lib/test/test_telnetlib.py | 2 | ||||
-rw-r--r-- | Lib/test/test_timeout.py | 8 | ||||
-rw-r--r-- | Lib/test/test_urllib.py | 2 |
18 files changed, 33 insertions, 33 deletions
diff --git a/Lib/multiprocessing/forkserver.py b/Lib/multiprocessing/forkserver.py index 387517e..5c0a1bd 100644 --- a/Lib/multiprocessing/forkserver.py +++ b/Lib/multiprocessing/forkserver.py @@ -107,7 +107,7 @@ class ForkServer(object): address = connection.arbitrary_address('AF_UNIX') listener.bind(address) os.chmod(address, 0o600) - listener.listen(100) + listener.listen() # all client processes own the write end of the "alive" pipe; # when they all terminate the read end becomes ready. diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 44d6c71..78208c3 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -2543,7 +2543,7 @@ class _TestPicklingConnections(BaseTestCase): l = socket.socket() l.bind((test.support.HOST, 0)) - l.listen(1) + l.listen() conn.send(l.getsockname()) new_conn, addr = l.accept() conn.send(new_conn) @@ -3190,7 +3190,7 @@ class TestWait(unittest.TestCase): from multiprocessing.connection import wait l = socket.socket() l.bind((test.support.HOST, 0)) - l.listen(4) + l.listen() addr = l.getsockname() readers = [] procs = [] diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index fd64adc..b74b944 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -37,7 +37,7 @@ if threading: self.start_resend_event = None def run(self): - self.sock.listen(1) + self.sock.listen() self.event.set() conn, client = self.sock.accept() self.buffer = b"" diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index b065749..cce6467 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -428,7 +428,7 @@ class EventLoopTestsMixin: listener = socket.socket() listener.setblocking(False) listener.bind(('127.0.0.1', 0)) - listener.listen(1) + listener.listen() client = socket.socket() client.connect(listener.getsockname()) diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index b4f474f..8882b80 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -64,7 +64,7 @@ class crashingdummy: # used when testing senders; just collects what it gets until newline is sent def capture_server(evt, buf, serv): try: - serv.listen(5) + serv.listen() conn, addr = serv.accept() except socket.timeout: pass diff --git a/Lib/test/test_epoll.py b/Lib/test/test_epoll.py index b37f033..d727403 100644 --- a/Lib/test/test_epoll.py +++ b/Lib/test/test_epoll.py @@ -44,7 +44,7 @@ class TestEPoll(unittest.TestCase): def setUp(self): self.serverSocket = socket.socket() self.serverSocket.bind(('127.0.0.1', 0)) - self.serverSocket.listen(1) + self.serverSocket.listen() self.connections = [self.serverSocket] def tearDown(self): diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index a9bf30b..e043828 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -137,7 +137,7 @@ class DummyFTPHandler(asynchat.async_chat): def cmd_pasv(self, arg): with socket.socket() as sock: sock.bind((self.socket.getsockname()[0], 0)) - sock.listen(5) + sock.listen() sock.settimeout(TIMEOUT) ip, port = sock.getsockname()[:2] ip = ip.replace('.', ','); p1 = port / 256; p2 = port % 256 @@ -155,7 +155,7 @@ class DummyFTPHandler(asynchat.async_chat): def cmd_epsv(self, arg): with socket.socket(socket.AF_INET6) as sock: sock.bind((self.socket.getsockname()[0], 0)) - sock.listen(5) + sock.listen() sock.settimeout(TIMEOUT) port = sock.getsockname()[1] self.push('229 entering extended passive mode (|||%d|)' %port) @@ -983,7 +983,7 @@ class TestTimeouts(TestCase): # 1) when the connection is ready to be accepted. # 2) when it is safe for the caller to close the connection # 3) when we have closed the socket - self.sock.listen(5) + self.sock.listen() # (1) Signal the caller that we are ready to accept the connection. self.evt.set() try: diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 1a6d8d0..00c272c 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -919,7 +919,7 @@ class SourceAddressTest(TestCase): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.port = support.bind_port(self.serv) self.source_port = support.find_unused_port() - self.serv.listen(5) + self.serv.listen() self.conn = None def tearDown(self): @@ -951,7 +951,7 @@ class TimeoutTest(TestCase): def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) TimeoutTest.PORT = support.bind_port(self.serv) - self.serv.listen(5) + self.serv.listen() def tearDown(self): self.serv.close() diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py index bafdeba..0810f21 100644 --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -89,7 +89,7 @@ class TestKQueue(unittest.TestCase): def test_queue_event(self): serverSocket = socket.socket() serverSocket.bind(('127.0.0.1', 0)) - serverSocket.listen(1) + serverSocket.listen() client = socket.socket() client.setblocking(False) try: diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index d695a0d..8ff6d7f 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -451,7 +451,7 @@ class TestTimeouts(TestCase): del self.thread # Clear out any dangling Thread objects. def server(self, evt, serv): - serv.listen(5) + serv.listen() evt.set() try: conn, addr = serv.accept() diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py index a91fe78..c2eba15 100644 --- a/Lib/test/test_selectors.py +++ b/Lib/test/test_selectors.py @@ -24,7 +24,7 @@ else: def socketpair(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0): with socket.socket(family, type, proto) as l: l.bind((support.HOST, 0)) - l.listen(3) + l.listen() c = socket.socket(family, type, proto) try: c.connect(l.getsockname()) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 784c422..816ed83 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -31,7 +31,7 @@ if sys.platform == 'darwin': def server(evt, buf, serv): - serv.listen(5) + serv.listen() evt.set() try: conn, addr = serv.accept() diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 0712a4f..950d0dc 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -72,7 +72,7 @@ class SocketTCPTest(unittest.TestCase): def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.port = support.bind_port(self.serv) - self.serv.listen(1) + self.serv.listen() def tearDown(self): self.serv.close() @@ -441,7 +441,7 @@ class SocketListeningTestMixin(SocketTestBase): def setUp(self): super().setUp() - self.serv.listen(1) + self.serv.listen() class ThreadedSocketTestMixin(ThreadSafeCleanupTestCase, SocketTestBase, @@ -3784,7 +3784,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM | socket.SOCK_NONBLOCK) self.port = support.bind_port(self.serv) - self.serv.listen(1) + self.serv.listen() # actual testing start = time.time() try: @@ -4559,7 +4559,7 @@ class TestLinuxAbstractNamespace(unittest.TestCase): address = b"\x00python-test-hello\x00\xff" with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s1: s1.bind(address) - s1.listen(1) + s1.listen() with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s2: s2.connect(s1.getsockname()) with s1.accept()[0] as s3: @@ -4791,7 +4791,7 @@ class TIPCThreadableTest(unittest.TestCase, ThreadableTest): srvaddr = (socket.TIPC_ADDR_NAMESEQ, TIPC_STYPE, TIPC_LOWER, TIPC_UPPER) self.srv.bind(srvaddr) - self.srv.listen(5) + self.srv.listen() self.serverExplicitReady() self.conn, self.connaddr = self.srv.accept() self.addCleanup(self.conn.close) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 80fb062..01aa82a 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1211,7 +1211,7 @@ class SSLErrorTests(unittest.TestCase): ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) with socket.socket() as s: s.bind(("127.0.0.1", 0)) - s.listen(5) + s.listen() c = socket.socket() c.connect(s.getsockname()) c.setblocking(False) @@ -1736,7 +1736,7 @@ else: def run(self): self.sock.settimeout(0.05) - self.sock.listen(5) + self.sock.listen() self.active = True if self.flag: # signal an event @@ -2162,7 +2162,7 @@ else: # and sets Event `listener_gone` to let the main thread know # the socket is gone. def listener(): - s.listen(5) + s.listen() listener_ready.set() newsock, addr = s.accept() newsock.close() @@ -2590,7 +2590,7 @@ else: finish = False def serve(): - server.listen(5) + server.listen() started.set() conns = [] while not finish: @@ -2647,7 +2647,7 @@ else: peer = None def serve(): nonlocal remote, peer - server.listen(5) + server.listen() # Block on the accept and wait on the connection to close. evt.set() remote, peer = server.accept() diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 9bd0a01..212c9f3 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -84,7 +84,7 @@ class TestSupport(unittest.TestCase): def test_bind_port(self): s = socket.socket() support.bind_port(s) - s.listen(1) + s.listen() s.close() # Tests for temp_dir() diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py index ee1c357..e1ef99a 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -11,7 +11,7 @@ threading = support.import_module('threading') HOST = support.HOST def server(evt, serv): - serv.listen(5) + serv.listen() evt.set() try: conn, addr = serv.accept() diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py index 703c43a..3c75dcc 100644 --- a/Lib/test/test_timeout.py +++ b/Lib/test/test_timeout.py @@ -243,14 +243,14 @@ class TCPTimeoutTestCase(TimeoutTestCase): def testAcceptTimeout(self): # Test accept() timeout support.bind_port(self.sock, self.localhost) - self.sock.listen(5) + self.sock.listen() self._sock_operation(1, 1.5, 'accept') def testSend(self): # Test send() timeout with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv: support.bind_port(serv, self.localhost) - serv.listen(5) + serv.listen() self.sock.connect(serv.getsockname()) # Send a lot of data in order to bypass buffering in the TCP stack. self._sock_operation(100, 1.5, 'send', b"X" * 200000) @@ -259,7 +259,7 @@ class TCPTimeoutTestCase(TimeoutTestCase): # Test sendto() timeout with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv: support.bind_port(serv, self.localhost) - serv.listen(5) + serv.listen() self.sock.connect(serv.getsockname()) # The address argument is ignored since we already connected. self._sock_operation(100, 1.5, 'sendto', b"X" * 200000, @@ -269,7 +269,7 @@ class TCPTimeoutTestCase(TimeoutTestCase): # Test sendall() timeout with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv: support.bind_port(serv, self.localhost) - serv.listen(5) + serv.listen() self.sock.connect(serv.getsockname()) # Send a lot of data in order to bypass buffering in the TCP stack. self._sock_operation(100, 1.5, 'sendall', b"X" * 200000) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 1a5013e..ca029d3 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -1333,7 +1333,7 @@ class URLopener_Tests(unittest.TestCase): # serv.settimeout(3) # serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # serv.bind(("", 9093)) -# serv.listen(5) +# serv.listen() # try: # conn, addr = serv.accept() # conn.send("1 Hola mundo\n") |