IPv6 start error. fix #306
This commit is contained in:
1 parent
80afd9a67c
commit
85cb9be064
1 file changed
+3
-1
@@ -238,12 +238,14 @@ def bind_sockets(port, address=None, family=socket.AF_UNSPEC, backlog=128):
|
|||||||
if address == "":
|
if address == "":
|
||||||
address = None
|
address = None
|
||||||
flags = socket.AI_PASSIVE
|
flags = socket.AI_PASSIVE
|
||||||
if hasattr(socket, "AI_ADDRCONFIG"):
|
try:
|
||||||
# AI_ADDRCONFIG ensures that we only try to bind on ipv6
|
# AI_ADDRCONFIG ensures that we only try to bind on ipv6
|
||||||
# if the system is configured for it, but the flag doesn't
|
# if the system is configured for it, but the flag doesn't
|
||||||
# exist on some platforms (specifically WinXP, although
|
# exist on some platforms (specifically WinXP, although
|
||||||
# newer versions of windows have it)
|
# newer versions of windows have it)
|
||||||
flags |= socket.AI_ADDRCONFIG
|
flags |= socket.AI_ADDRCONFIG
|
||||||
|
except:
|
||||||
|
pass
|
||||||
for res in set(socket.getaddrinfo(address, port, family, socket.SOCK_STREAM,
|
for res in set(socket.getaddrinfo(address, port, family, socket.SOCK_STREAM,
|
||||||
0, flags)):
|
0, flags)):
|
||||||
af, socktype, proto, canonname, sockaddr = res
|
af, socktype, proto, canonname, sockaddr = res
|
||||||
|
|||||||
Reference in new issue
Block a user