�
u��g�% � �� � 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 dej fd�Z ddej deeeeef ded e e
e de eej d
e e dej fd�Z dde
e dedee fd�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 � �: �������K � |x�st j � � �t | � � dk }|�|�d}|r|st | |� � } d}g �|�|r9| D ]5} t ��|�d�� � � d{V ��} n# t
t f$ r Y �2w xY wn�t � � � t j �����fd�| D � � |� � � d{V ��\ }} } �D ]K}
|
|urEt j t � � 5 |
� � � ddd� � n# 1 swxY w Y �Ld�nU# �D ]K}
|
|urEt j t � � 5 |
� � � ddd� � n# 1 swxY w Y �Ld�w xY w|��%d� �D � � } |d }t |� � dk r|�t |� � �t �fd�|D � � � � r|�d� d� d � |D � � � � � � }
t# |t � � r3|j �t �fd
�|D � � � � rt
�|
� � �n=t# |t
� � r(t d� |D � � � � rt |
� � �t
|
� � �# d}d�w xY 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 �V �K � | ]#}t j t ��|���� � V � �$d S �N)� functools�partial�
_connect_sock)�.0�addrinfo�current_loop�
exceptionsr �open_socketsr s ������e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/aiohappyeyeballs/impl.py� <genexpr>z#start_connection.<locals>.<genexpr>X s[ �� � � � � � !� �%�%�$�"� �(�$�&�� �� � � � � � c � � g | ] }|D ]}|���
S � r"