From: Mauricio Souza Lima Date: Tue, 7 May 2013 21:00:23 +0000 (-0300) Subject: change bind_unused_port to pass None as port X-Git-Tag: v3.1.0~76^2~19^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dceb544fb51b11fe6f97365cc036e9f3775cb00f;p=thirdparty%2Ftornado.git change bind_unused_port to pass None as port bind_unused_port was passing 0 as port number to the socket module. This generated some exceptional behaviour on systems where nslookup of localhost didn't returned the loopback interface. --- diff --git a/tornado/testing.py b/tornado/testing.py index 00364f124..f537d90d2 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -77,7 +77,7 @@ def bind_unused_port(): Returns a tuple (socket, port). """ - [sock] = netutil.bind_sockets(0, 'localhost', family=socket.AF_INET) + [sock] = netutil.bind_sockets(None, 'localhost', family=socket.AF_INET) port = sock.getsockname()[1] return sock, port