]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
change bind_unused_port to pass None as port 777/head
authorMauricio Souza Lima <mauricio.lima@corp.globo.com>
Tue, 7 May 2013 21:00:23 +0000 (18:00 -0300)
committerMauricio Souza Lima <mauricio.lima@corp.globo.com>
Tue, 7 May 2013 21:00:23 +0000 (18:00 -0300)
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.

tornado/testing.py

index 00364f124329aa7759fc1bf10a3ed421beaa9429..f537d90d21d682467b8c9d4d4e0e66b37e3a76f2 100644 (file)
@@ -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