File: //usr/local/lib/python3.10/dist-packages/aiohappyeyeballs/__pycache__/impl.cpython-310.pyc
o
���g �
@ s
d Z ddlZddlZddlZddlZddlZddlmZmZm Z m
Z
ddlmZ ddl
mZ ddddd�de e d ee e d
ee dee deej d
ejfdd�Z ddejdeee
eef ded ee e d
ejf
dd�Z dde e ded
ee fdd�ZdS )zBase implementation.� N)�List�Optional�Sequence�Union� )�
_staggered)�AddrInfoType)�local_addr_infos�happy_eyeballs_delay�
interleave�loop�
addr_infosr r
r r �returnc
� s� �| � s t �� � t| �dk}|dur|du rd}|r"|s"t| |�} d}g �|du s,|rJ| D ]}z
t� �|��I dH }W n ttfyH Y q.w nt�� ��fdd�| D �|�I dH \}}}|du r�dd� �D �} z\| d }
t| �dkrw|
�t |
��t
�fdd�| D ��r�|
�d �d
�dd� | D ���}t
|
t�r�|
j�t
�fdd�| D ��r�t�|��t|��t
|
t�r�t
d
d� | D ��r�t|��t|��d} d�w |S )aM
Connect to a TCP server.
Create a socket connection to a specified destination. The
destination is specified as a list of AddrInfoType tuples as
returned from getaddrinfo().
The arguments are, in order:
* ``family``: the address family, e.g. ``socket.AF_INET`` or
``socket.AF_INET6``.
* ``type``: the socket type, e.g. ``socket.SOCK_STREAM`` or
``socket.SOCK_DGRAM``.
* ``proto``: the protocol, e.g. ``socket.IPPROTO_TCP`` or
``socket.IPPROTO_UDP``.
* ``canonname``: the canonical name of the address, e.g.
``"www.python.org"``.
* ``sockaddr``: the socket address
This method is a coroutine which will try to establish the connection
in the background. When successful, the coroutine returns a
socket.
The expected use case is to use this method in conjunction with
loop.create_connection() to establish a connection to a server::
socket = await start_connection(addr_infos)
transport, protocol = await loop.create_connection(
MyProtocol, sock=socket, ...)
r Nc 3 s"