| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/tornado/__pycache__/ |
Upload File : |
�
��b,/ � �� � d Z ddlZddlZddlZddlZddlZddlmZmZ ddl m
Z
ddlmZ ddl
mZ ddlmZ ddlmZ dd lmZmZmZmZmZmZmZmZmZ d
Z G d� de� � Z G d
� de� � Z dS )z'A non-blocking TCP connection factory.
� N)�Future�future_add_done_callback)�IOLoop)�IOStream)�gen)�Resolver)�TimeoutError) �Any�Union�Dict�Tuple�List�Callable�Iterator�Optional�Setg333333�?c
� � e Zd ZdZdee deej egee df f ddfd�Z
edee deeeej ef eeej ef f fd�� � Ze
dfd ed
eeeej f ddfd�Zd
eeej ef ddfd�Zd
eeej ef dej deddddf
d�Zd eddfd�Zdd�Zdd�Zd
eeej f ddfd�Zdd�Zdd�Zdd�ZdS )�
_Connectora� A stateless implementation of the "Happy Eyeballs" algorithm.
"Happy Eyeballs" is documented in RFC6555 as the recommended practice
for when both IPv4 and IPv6 addresses are available.
In this implementation, we partition the addresses by family, and
make the first connection attempt to whichever address was
returned first by ``getaddrinfo``. If that connection fails or
times out, we begin a connection in parallel to the first address
of the other family. If there are additional failures we retry
with other addresses, keeping one connection attempt per family
in flight at a time.
http://tools.ietf.org/html/rfc6555
�addrinfo�connect�Future[IOStream]�returnNc �& � t j � � | _ || _ t � � | _ d | _ d | _ d | _ t |� � | _
| � |� � \ | _ | _
t � � | _ d S �N)r �current�io_loopr r �future�timeout�connect_timeout�
last_error�len� remaining�split�
primary_addrs�secondary_addrs�set�streams)�selfr r s �3/usr/lib/python3/dist-packages/tornado/tcpclient.py�__init__z_Connector.__init__7 sz � � �~�'�'������
�H�H�
�� ���#�������X�����37�:�:�h�3G�3G�0���D�0��u�u����� c � � g }g }| d d }| D ]:\ }}||k r|� ||f� � �#|� ||f� � �;||fS )a� Partition the ``addrinfo`` list by address family.
Returns two lists. The first list contains the first entry from
``addrinfo`` and all others with the same family, and the
second list contains all other addresses (normally one list will
be AF_INET and the other AF_INET6, although non-standard resolvers
may return additional families).
r )�append)r �primary� secondary�
primary_af�af�addrs r) r# z_Connector.splitK sx � � ��� ��a�[��^�
� � -� -�H�B���Z�������D�z�*�*�*�*�� � �"�d��,�,�,�,�� �!�!r+ r r z2Future[Tuple[socket.AddressFamily, Any, IOStream]]c � � | � t | j � � � � | � |� � |�| � |� � | j S r )�try_connect�iterr$ �set_timeout�set_connect_timeoutr )r( r r s r) �startz_Connector.startd sY � �
����d�0�1�1�2�2�2�����!�!�!��&��$�$�_�5�5�5��{�r+ �addrsc � � t |� � \ }}nc# t $ rV | j dk rG| j � � � s.| j � | j pt d� � � � Y d S w xY w| � ||� � \ }}| j �
|� � t |t j
| j |||� � � � d S )Nr zconnection failed)�next�
StopIterationr"