Skip to content

Commit 2b87096

Browse files
committed
Fix _check_resolved_address() for IPv6 address
1 parent 7571492 commit 2b87096

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

asyncio/base_events.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@ def _check_resolved_address(sock, address):
4545
# Ensure that the address is already resolved to avoid the trap of hanging
4646
# the entire event loop when the address requires doing a DNS lookup.
4747
family = sock.family
48-
if family not in (socket.AF_INET, socket.AF_INET6):
48+
if family == socket.AF_INET:
49+
host, port = address
50+
elif family == socket.AF_INET6:
51+
host, port, flow_info, scope_id = address
52+
else:
4953
return
5054

51-
host, port = address
5255
type_mask = 0
5356
if hasattr(socket, 'SOCK_NONBLOCK'):
5457
type_mask |= socket.SOCK_NONBLOCK

0 commit comments

Comments
 (0)