File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/aiohappyeyeballs/__pycache__/impl.cpython-310.pyc
Back
o ;j�% � @ s> d Z ddlZddlZddlZddlZddlZddlZddlmZm Z m Z mZmZ ddl mZ ddlmZmZ dddddd�de e d e e e d e e de e de ej d e e dejfdd�Z ddejdeeeeef ded e e e de eej d e e dejfdd�Z dde e dedee fdd�ZdS )zBase implementation.� N)�List�Optional�Sequence�Set�Union� )� _staggered)�AddrInfoType�SocketFactoryType)�local_addr_infos�happy_eyeballs_delay� interleave�loop�socket_factory� addr_infosr r r r r �returnc � sL �| � s t �� � t| �dk}|dur|du rd}|r"|s"t| |�} d}g �|du s,|rL| D ]}zt� �|�d��I dH }W n ttfyJ Y q.w nft� �z=t� � ����fdd�| D �|�I dH \}} } W �D ]} | |ur�t �t�� | �� W d � n1 s�w Y qjd�n%�D ]} | |ur�t �t�� | �� W d � n1 s�w Y q�d�w |du �r$dd� �D �}z`|d }t|�dkr�|�t |��t�fdd�|D ��r�|�d �d �dd� |D ���} t|t��r|j�t�fdd�|D ���rt�| ��t| ��t|t��rtd d� |D ���rt| ��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&