From: Ben Darnell Date: Sun, 18 Jan 2015 16:31:26 +0000 (-0500) Subject: Prevent a double-timeout in TCPClient. X-Git-Tag: v4.1.0b1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a293354cebc0b28c6b709bf9202775f30242759;p=thirdparty%2Ftornado.git Prevent a double-timeout in TCPClient. This fixes a non-deterministic failure in the tests. Also fix another less-common failure in test.util.refusing_port. --- diff --git a/tornado/tcpclient.py b/tornado/tcpclient.py index 0abbea200..163e5c16a 100644 --- a/tornado/tcpclient.py +++ b/tornado/tcpclient.py @@ -111,6 +111,7 @@ class _Connector(object): if self.timeout is not None: # If the first attempt failed, don't wait for the # timeout to try an address from the secondary queue. + self.io_loop.remove_timeout(self.timeout) self.on_timeout() return self.clear_timeout() diff --git a/tornado/test/util.py b/tornado/test/util.py index 4f0c07e5e..358809f21 100644 --- a/tornado/test/util.py +++ b/tornado/test/util.py @@ -42,6 +42,7 @@ def refusing_port(): # ephemeral port number to ensure that nothing can listen on that # port. server_socket, port = bind_unused_port() + server_socket.setblocking(1) client_socket = socket.socket() client_socket.connect(("127.0.0.1", port)) conn, client_addr = server_socket.accept()