o
    çûõjä  ã                   @   sp   d dl Z d dlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 er(ddlmZ eeefZG dd	„ d	e jƒZdS )
é    N)ÚTYPE_CHECKINGÚAnyÚcasté   )ÚClientConnectionResetError)Úset_exception)Útcp_nodelay)Ú
HttpParserc                   @   sÞ   e Zd ZdZ	d'dejddddfdd„Zedefd	d
„ƒZ	edefdd„ƒZ
d(dd„Zd(dd„Zd(dd„Zd(dd„Zd(dd„Zd(dd„Zd(dd„Zd)deddfdd„Zdejddfd d!„Zd"edB ddfd#d$„Zd(d%d&„ZdS )*ÚBaseProtocol)	Ú_loopÚ_pausedÚ_parserÚ_drain_waiterÚ_connection_lostÚ_reading_pausedÚ_buffer_pausedÚ	_upgradedÚ	transportNÚloopÚparserzHttpParser[Any] | NoneÚreturnc                 C   s4   || _ d| _d | _d| _d| _|| _d| _d | _d S ©NF)r   r   r   r   r   r   r   r   )Úselfr   r   © r   úH/opt/steambot/venv/lib/python3.10/site-packages/aiohttp/base_protocol.pyÚ__init__    s   
zBaseProtocol.__init__c                 C   s
   | j duS )z&Return True if the connection is open.N)r   ©r   r   r   r   Ú	connected-   s   
zBaseProtocol.connectedc                 C   s   | j S ©N©r   r   r   r   r   Úwriting_paused2   s   zBaseProtocol.writing_pausedc                 C   s   | j rJ ‚d| _ d S ©NTr   r   r   r   r   Úpause_writing6   s   

zBaseProtocol.pause_writingc                 C   sB   | j sJ ‚d| _ | j}|d urd | _| ¡ s| d ¡ d S d S d S r   )r   r   ÚdoneÚ
set_result©r   Úwaiterr   r   r   Úresume_writing:   s   
ýzBaseProtocol.resume_writingc                 C   s0   d| _ | js| jd usJ ‚| j ¡  |  ¡  d S r!   )r   r   r   Úpause_readingÚ_pause_transport_readingr   r   r   r   r(   D   s
   
zBaseProtocol.pause_readingc                 C   s   d| _ |  ¡  dS )a  Hold the transport for a buffer this protocol cannot drain yet.

        One flag covers every buffer a protocol owns; the server already
        multiplexes its message queue and its tail through it. Re-check the
        conditions on resume rather than adding another flag.
        TN)r   r)   r   r   r   r   Ú_pause_reading_for_bufferL   s   z&BaseProtocol._pause_reading_for_bufferc                 C   s   d| _ | js|  ¡  dS dS )z?Release that hold, unless flow control is still holding it too.FN)r   r   Ú_resume_transport_readingr   r   r   r   Ú_resume_reading_for_bufferV   s   ÿz'BaseProtocol._resume_reading_for_bufferc                 C   ó4   | j d urz| j  ¡  W d S  ty   Y d S w d S r   )r   r(   ÚPAUSE_RESUME_READING_ERRORSr   r   r   r   r)   \   ó   
ýýz%BaseProtocol._pause_transport_readingc                 C   r-   r   )r   Úresume_readingr.   r   r   r   r   r+   e   r/   z&BaseProtocol._resume_transport_readingTÚresume_parserc                 C   s:   d| _ | js|r|  d¡ | j s| js|  ¡  d S d S d S )NFó    )r   r   Údata_receivedr   r+   )r   r1   r   r   r   r0   n   s   

ÿzBaseProtocol.resume_readingr   c                 C   s    t tj|ƒ}t|dƒ || _d S r!   )r   ÚasyncioÚ	Transportr   r   )r   r   Útrr   r   r   Úconnection_madez   s   

zBaseProtocol.connection_madeÚexcc                 C   s^   d | _ | jsd S | j}|d u rd S d | _| ¡ rd S |d u r%| d ¡ d S t|tdƒ|ƒ d S ©NzConnection lost)r   r   r   r#   r$   r   ÚConnectionError)r   r8   r&   r   r   r   Úconnection_lost   s    ýzBaseProtocol.connection_lostc                 Ã   sJ   �| j d u r
tdƒ‚| jsd S | j}|d u r| j ¡ }|| _|I d H  d S r9   )r   r   r   r   r   Úcreate_futurer%   r   r   r   Ú_drain_helper“   s   €

zBaseProtocol._drain_helperr   )r   N)T)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r4   ÚAbstractEventLoopr   ÚpropertyÚboolr   r    r"   r'   r(   r*   r,   r)   r+   r0   ÚBaseTransportr7   ÚBaseExceptionr;   r=   r   r   r   r   r
      s2    ÿÿÿ
þ








		r
   )r4   Útypingr   r   r   Úclient_exceptionsr   Úhelpersr   Útcp_helpersr   Úhttp_parserr	   ÚAttributeErrorÚNotImplementedErrorÚRuntimeErrorr.   ÚProtocolr
   r   r   r   r   Ú<module>   s    
