asyncio: Fix _check_resolved_address() for IPv6 address
This commit is contained in:
parent
da492a8c39
commit
013dece44d
|
@ -45,10 +45,13 @@ def _check_resolved_address(sock, address):
|
||||||
# Ensure that the address is already resolved to avoid the trap of hanging
|
# Ensure that the address is already resolved to avoid the trap of hanging
|
||||||
# the entire event loop when the address requires doing a DNS lookup.
|
# the entire event loop when the address requires doing a DNS lookup.
|
||||||
family = sock.family
|
family = sock.family
|
||||||
if family not in (socket.AF_INET, socket.AF_INET6):
|
if family == socket.AF_INET:
|
||||||
|
host, port = address
|
||||||
|
elif family == socket.AF_INET6:
|
||||||
|
host, port, flow_info, scope_id = address
|
||||||
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
host, port = address
|
|
||||||
type_mask = 0
|
type_mask = 0
|
||||||
if hasattr(socket, 'SOCK_NONBLOCK'):
|
if hasattr(socket, 'SOCK_NONBLOCK'):
|
||||||
type_mask |= socket.SOCK_NONBLOCK
|
type_mask |= socket.SOCK_NONBLOCK
|
||||||
|
|
Loading…
Reference in New Issue