Mercurial > hg
changeset 30985:1f803482844a
runtests: checkportisavailable should only check one family
As explained by the previous patch, checkportisavailable() should only check
the preferred family - either IPv4 or IPv6, not both.
This patch makes it so.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 15 Feb 2017 16:22:22 -0800 |
parents | 15f9084a9a0c |
children | f07ca071a058 |
files | tests/run-tests.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Wed Feb 15 16:18:31 2017 -0800 +++ b/tests/run-tests.py Wed Feb 15 16:22:22 2017 -0800 @@ -137,10 +137,11 @@ def checkportisavailable(port): """return true if a port seems free to bind on localhost""" - families = [getattr(socket, i, None) - for i in ('AF_INET', 'AF_INET6') - if getattr(socket, i, None) is not None] - for family in families: + if useipv6: + family = socket.AF_INET6 + else: + family = socket.AF_INET + if True: try: s = socket.socket(family, socket.SOCK_STREAM) s.bind(('localhost', port))