
    hQ
                    x    d dl mZ d dlZd dlZd dlmZ ddlmZmZ  ej	        e
          Z G d d          ZdS )    )annotationsN)
DataCenter   )TCPTCPAbridgedc                  8    e Zd ZdZdddZd Zd ZddZddZdS )
Connection   Fdc_idint	test_modeboolipv6proxydictmediac                    || _         || _        || _        || _        || _        t          ||||          | _        d | _        d S N)r   r   r   r   r   r   addressprotocol)selfr   r   r   r   r   s         _/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/hydrogram/connection/connection.py__init__zConnection.__init__#   sE    
"	

!%D%@@!    c                  K   t          t          j                  D ]}t          | j        | j                  | _        	 t                              d           | j        	                    | j
                   d {V  t                              d| j        rdnd| j        | j        rdnd| j        rdnd            d S # t          $ r_}t                              d	|           | j                                         d {V  t#          j        d
           d {V  Y d }~d }~ww xY wt                              d           t&          )NzConnecting...zConnected! %s DC%s%s - IPv%sTest
Productionz (media) 64z+Unable to connect due to network issues: %sr   z"Connection failed! Trying again...)ranger	   MAX_CONNECTION_ATTEMPTSr   r   r   r   loginfoconnectr   r   r   r   OSErrorwarningcloseasynciosleepConnectionError)r   ies      r   r%   zConnection.connect-   sq     z9:: 	" 	"A'	4:>>DM)))m++DL999999999 2"n>FF,J"&*4JJ"9-CC#     ' ' 'I1MMMm))+++++++++mA&&&&&&&&&&&&&&' KK<===!!s   ?B??
D(	AD##D(c                |   K   | j                                          d {V  t                              d           d S )NDisconnected)r   r(   r#   r$   r   s    r   r(   zConnection.closeE   sD      m!!#########     r   databytesc                J   K   | j                             |           d {V  d S r   )r   send)r   r1   s     r   r4   zConnection.sendI   s4      m  &&&&&&&&&&&r   returnbytes | Nonec                D   K   | j                                          d {V S r   )r   recvr0   s    r   r8   zConnection.recvL   s,      ]'')))))))))r   N)F)
r   r   r   r   r   r   r   r   r   r   )r1   r2   )r5   r6   )	__name__
__module____qualname__r"   r   r%   r(   r4   r8    r   r   r	   r	       sy        " " " " "" " "0! ! !' ' ' '* * * * * *r   r	   )
__future__r   r)   logginghydrogram.session.internalsr   	transportr   r   	getLoggerr9   r#   r	   r<   r   r   <module>rB      s   ( # " " " " "   2 2 2 2 2 2 ' ' ' ' ' ' ' 'g!!-* -* -* -* -* -* -* -* -* -*r   