##// END OF EJS Templates
runtests: prefer IPv4 to IPv6...
Jun Wu -
r31002:a489ee9b default
parent child Browse files
Show More
@@ -113,9 +113,13 b' else:'
113 113 wifexited = getattr(os, "WIFEXITED", lambda x: False)
114 114
115 115 # Whether to use IPv6
116 def checkipv6available(port=20058):
117 """return true if we can listen on localhost's IPv6 ports"""
118 family = getattr(socket, 'AF_INET6', None)
116 def checksocketfamily(name, port=20058):
117 """return true if we can listen on localhost using family=name
118
119 name should be either 'AF_INET', or 'AF_INET6'.
120 port being used is okay - EADDRINUSE is considered as successful.
121 """
122 family = getattr(socket, name, None)
119 123 if family is None:
120 124 return False
121 125 try:
@@ -133,7 +137,8 b' def checkipv6available(port=20058):'
133 137 else:
134 138 return False
135 139
136 useipv6 = checkipv6available()
140 # IPv6 is used if IPv4 is not available and IPv6 is available.
141 useipv6 = (not checksocketfamily('AF_INET')) and checksocketfamily('AF_INET6')
137 142
138 143 def checkportisavailable(port):
139 144 """return true if a port seems free to bind on localhost"""
General Comments 0
You need to be logged in to leave comments. Login now