Show More
@@ -137,10 +137,11 b' useipv6 = checkipv6available()' | |||||
137 |
|
137 | |||
138 | def checkportisavailable(port): |
|
138 | def checkportisavailable(port): | |
139 | """return true if a port seems free to bind on localhost""" |
|
139 | """return true if a port seems free to bind on localhost""" | |
140 | families = [getattr(socket, i, None) |
|
140 | if useipv6: | |
141 | for i in ('AF_INET', 'AF_INET6') |
|
141 | family = socket.AF_INET6 | |
142 | if getattr(socket, i, None) is not None] |
|
142 | else: | |
143 | for family in families: |
|
143 | family = socket.AF_INET | |
|
144 | if True: | |||
144 | try: |
|
145 | try: | |
145 | s = socket.socket(family, socket.SOCK_STREAM) |
|
146 | s = socket.socket(family, socket.SOCK_STREAM) | |
146 | s.bind(('localhost', port)) |
|
147 | s.bind(('localhost', port)) |
General Comments 0
You need to be logged in to leave comments.
Login now