Commit 40954c7e authored by Jim Fulton's avatar Jim Fulton

Fixed a bug in the logic for finding available sockets for testing.

Maybe this will reduce the chance if spurious test failures due to
addresses already in use.  Unfortunately, there's still a race that
may make running tests in parallel impractical until it's addressed.
parent 557e4b40
...@@ -220,10 +220,20 @@ def get_port(): ...@@ -220,10 +220,20 @@ def get_port():
try: try:
try: try:
s.connect(('localhost', port)) s.connect(('localhost', port))
except socket.error:
pass # Perhaps we should check value of error too.
else:
continue
try:
s1.connect(('localhost', port+1)) s1.connect(('localhost', port+1))
except socket.error: except socket.error:
# Perhaps we should check value of error too. pass # Perhaps we should check value of error too.
else:
continue
return port return port
finally: finally:
s.close() s.close()
s1.close() s1.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment