AlkantarClanX12

Your IP : 3.136.25.249


Current Path : /opt/alt/python312/lib64/python3.12/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/sslproto.cpython-312.pyc

�

�Q�f�{��z�ddlZddlZddlZ	ddlZddlmZddlmZddlmZddlm	Z	ddl
mZe�ejejfZGd�d	ej�ZGd
�dej�Zd�Zd
�ZGd�de	j(e	j*�ZGd�dej.�Zy#e$rdZY��wxYw)�N�)�	constants)�
exceptions)�	protocols)�
transports)�loggerc� �eZdZdZdZdZdZdZy)�SSLProtocolState�	UNWRAPPED�DO_HANDSHAKE�WRAPPED�FLUSHING�SHUTDOWNN)�__name__�
__module__�__qualname__rrr
rr���7/opt/alt/python312/lib64/python3.12/asyncio/sslproto.pyr
r
s���I�!�L��G��H��Hrr
c��eZdZdZdZdZdZy)�AppProtocolState�
STATE_INIT�STATE_CON_MADE�	STATE_EOF�STATE_CON_LOSTN)rrrrrrrrrrrrs���J�%�N��I�%�Nrrc�Z�|rtd��tj�}|sd|_|S)Nz(Server side SSL needs a valid SSLContextF)�
ValueError�ssl�create_default_context�check_hostname)�server_side�server_hostname�
sslcontexts   r�_create_transport_contextr$/s2����C�D�D��+�+�-�J��$)�
�!��rc��|�|�|dz}n
|}d|z}n|}|�|dz}n|}||cxk\rdk\sntd|�d|�d���||fS)Ni�rzhigh (z) must be >= low (z) must be >= 0)r)�high�low�kb�hi�los     r�add_flowcontrol_defaultsr,=sh���|��;��d��B��B��R��B�
��
�{�
�1�W��
��
��=�q�=���b�"�#�	#��r�6�Mrc���eZdZdZej
jZd�Zdd�Z	d�Z
d�Zd�Zd�Z
efd	�Zd
�Zd�Zd�Zdd
�Zd�Zd�Zdd�Zd�Zd�Zed��Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!y)�_SSLProtocolTransportTc�.�||_||_d|_y)NF)�_loop�
_ssl_protocol�_closed)�self�loop�ssl_protocols   r�__init__z_SSLProtocolTransport.__init__Xs����
�)�����rNc�:�|jj||�S)z#Get optional transport information.)r1�_get_extra_info�r3�name�defaults   r�get_extra_infoz$_SSLProtocolTransport.get_extra_info]s���!�!�1�1�$��@�@rc�:�|jj|�y�N)r1�_set_app_protocol)r3�protocols  r�set_protocolz"_SSLProtocolTransport.set_protocolas�����,�,�X�6rc�.�|jjSr>)r1�
_app_protocol�r3s r�get_protocolz"_SSLProtocolTransport.get_protocolds���!�!�/�/�/rc��|jSr>)r2rDs r�
is_closingz _SSLProtocolTransport.is_closinggs���|�|�rc�n�|js"d|_|jj�yd|_y)a
Close the transport.

        Buffered data will be flushed asynchronously.  No more data
        will be received.  After all buffered data is flushed, the
        protocol's connection_lost() method will (eventually) called
        with None as its argument.
        TN)r2r1�_start_shutdownrDs r�closez_SSLProtocolTransport.closejs,���|�|��D�L����.�.�0�!%�D�rc�X�|jsd|_|jdt�yy)NTz9unclosed transport <asyncio._SSLProtocolTransport object>)r2�warn�ResourceWarning)r3�	_warningss  r�__del__z_SSLProtocolTransport.__del__xs)���|�|��D�L��N�N��*�
,�rc�0�|jjSr>)r1�_app_reading_pausedrDs r�
is_readingz _SSLProtocolTransport.is_readings���%�%�9�9�9�9rc�8�|jj�y)z�Pause the receiving end.

        No data will be passed to the protocol's data_received()
        method until resume_reading() is called.
        N)r1�_pause_readingrDs r�
pause_readingz#_SSLProtocolTransport.pause_reading�s��	
���)�)�+rc�8�|jj�y)z�Resume the receiving end.

        Data received will once again be passed to the protocol's
        data_received() method.
        N)r1�_resume_readingrDs r�resume_readingz$_SSLProtocolTransport.resume_reading�s��	
���*�*�,rc�p�|jj||�|jj�y)a�Set the high- and low-water limits for write flow control.

        These two values control when to call the protocol's
        pause_writing() and resume_writing() methods.  If specified,
        the low-water limit must be less than or equal to the
        high-water limit.  Neither value can be negative.

        The defaults are implementation-specific.  If only the
        high-water limit is given, the low-water limit defaults to an
        implementation-specific value less than or equal to the
        high-water limit.  Setting high to zero forces low to zero as
        well, and causes pause_writing() to be called whenever the
        buffer becomes non-empty.  Setting low to zero causes
        resume_writing() to be called only once the buffer is empty.
        Use of zero for either limit is generally sub-optimal as it
        reduces opportunities for doing I/O and computation
        concurrently.
        N)r1�_set_write_buffer_limits�_control_app_writing�r3r'r(s   r�set_write_buffer_limitsz-_SSLProtocolTransport.set_write_buffer_limits�s,��&	
���3�3�D�#�>����/�/�1rc�Z�|jj|jjfSr>)r1�_outgoing_low_water�_outgoing_high_waterrDs r�get_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits��*���"�"�6�6��"�"�7�7�9�	9rc�6�|jj�S)z-Return the current size of the write buffers.)r1�_get_write_buffer_sizerDs r�get_write_buffer_sizez+_SSLProtocolTransport.get_write_buffer_size�s���!�!�8�8�:�:rc�p�|jj||�|jj�y)a�Set the high- and low-water limits for read flow control.

        These two values control when to call the upstream transport's
        pause_reading() and resume_reading() methods.  If specified,
        the low-water limit must be less than or equal to the
        high-water limit.  Neither value can be negative.

        The defaults are implementation-specific.  If only the
        high-water limit is given, the low-water limit defaults to an
        implementation-specific value less than or equal to the
        high-water limit.  Setting high to zero forces low to zero as
        well, and causes pause_reading() to be called whenever the
        buffer becomes non-empty.  Setting low to zero causes
        resume_reading() to be called only once the buffer is empty.
        Use of zero for either limit is generally sub-optimal as it
        reduces opportunities for doing I/O and computation
        concurrently.
        N)r1�_set_read_buffer_limits�_control_ssl_readingr\s   r�set_read_buffer_limitsz,_SSLProtocolTransport.set_read_buffer_limits�s,��&	
���2�2�4��=����/�/�1rc�Z�|jj|jjfSr>)r1�_incoming_low_water�_incoming_high_waterrDs r�get_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limits�rbrc�6�|jj�S)z+Return the current size of the read buffer.)r1�_get_read_buffer_sizerDs r�get_read_buffer_sizez*_SSLProtocolTransport.get_read_buffer_size�s���!�!�7�7�9�9rc�.�|jjSr>)r1�_app_writing_pausedrDs r�_protocol_pausedz&_SSLProtocolTransport._protocol_paused�s���!�!�5�5�5rc��t|tttf�s!t	dt|�j����|sy|jj|f�y)z�Write some data bytes to the transport.

        This does not block; it buffers the data and arranges for it
        to be sent out asynchronously.
        z+data: expecting a bytes-like instance, got N)	�
isinstance�bytes�	bytearray�
memoryview�	TypeError�typerr1�_write_appdata�r3�datas  r�writez_SSLProtocolTransport.write�sX���$��	�:� >�?��#�#'��:�#6�#6�"7�9�:�
:������)�)�4�'�2rc�:�|jj|�y)z�Write a list (or any iterable) of data bytes to the transport.

        The default implementation concatenates the arguments and
        calls write() on the result.
        N)r1r{)r3�list_of_datas  r�
writelinesz _SSLProtocolTransport.writelines�s��	
���)�)�,�7rc��t�)zuClose the write end after flushing buffered data.

        This raises :exc:`NotImplementedError` right now.
        )�NotImplementedErrorrDs r�	write_eofz_SSLProtocolTransport.write_eof�s
��
"�!rc��y)zAReturn True if this transport supports write_eof(), False if not.FrrDs r�
can_write_eofz#_SSLProtocolTransport.can_write_eof�s��rc�&�|jd�y)z�Close the transport immediately.

        Buffered data will be lost.  No more data will be received.
        The protocol's connection_lost() method will (eventually) be
        called with None as its argument.
        N)�_force_closerDs r�abortz_SSLProtocolTransport.abort�s��	
���$�rc�b�d|_|j�|jj|�yy�NT)r2r1�_abort�r3�excs  rr�z"_SSLProtocolTransport._force_close�s.��������)����%�%�c�*�*rc��|jjj|�|jxjt	|�z
c_yr>)r1�_write_backlog�append�_write_buffer_size�lenr|s  r�_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs7�����)�)�0�0��6����-�-��T��:�-rr>�NN)"rrr�_start_tls_compatibler�
_SendfileMode�FALLBACK�_sendfile_compatibler6r<rArErGrJ�warningsrOrRrUrXr]rarerirmrp�propertyrsr~r�r�r�r�r�r�rrrr.r.Rs���!��$�2�2�;�;���
A�7�0��&�!)�,�:�,�-�2�,9�;�2�,9�:��6��6�3�8�"�� �+�
;rr.c��eZdZdZdZdZdZ				d*d�Zd�Zd+d�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd+d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d �Z$d,d!�Z%d"�Z&d#�Z'd$�Z(d,d%�Z)d&�Z*d'�Z+d(�Z,d-d)�Z-y).�SSLProtocoliNc
���t�td��t|j�|_t|j�|_|�tj}n|dkrtd|����|	�tj}	n|	dkrtd|	����|st||�}||_|r
|s||_
nd|_
||_t|��|_t#j$�|_d|_||_||_|j/|�d|_d|_d|_||_|	|_tj:�|_tj:�|_t@jB|_"d|_#|rtHjJ|_&ntHjN|_&|jjQ|j<|j>|j|j��|_)d|_*d|_+d|_,d|_-d|_.|j_�d|_0d|_1d|_2d|_3|ji�|jk�y)Nzstdlib ssl module not availablerz7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r#F)r!r")6r�RuntimeErrorrw�max_size�_ssl_bufferrx�_ssl_buffer_viewr�SSL_HANDSHAKE_TIMEOUTr�SSL_SHUTDOWN_TIMEOUTr$�_server_side�_server_hostname�_sslcontext�dict�_extra�collections�dequer�r��_waiterr0r?�_app_transport�_app_transport_created�
_transport�_ssl_handshake_timeout�_ssl_shutdown_timeout�	MemoryBIO�	_incoming�	_outgoingr
r�_state�
_conn_lostrr�
_app_stater�wrap_bio�_sslobj�_ssl_writing_pausedrQ�_ssl_reading_pausedrlrkrg�
_eof_receivedrrr`r_rZ�_get_app_transport)
r3r4�app_protocolr#�waiterr!r"�call_connection_made�ssl_handshake_timeout�ssl_shutdown_timeouts
          rr6zSSLProtocol.__init__sE��
�;��@�A�A�$�T�]�]�3��� *�4�+;�+;� <��� �(�$-�$C�$C�!�
"�a�
'���,�-�/�0�
0� �'�#,�#A�#A� �
!�Q�
&���+�,�.�/�
/��2��_�.�J�(����;�$3�D�!�$(�D�!�%����j�1���*�/�/�1���"#��������
����|�,�"���&+��#����&;��#�%9��"�������������&�0�0�������.�9�9�D�O�.�=�=�D�O��'�'�0�0��N�N�D�N�N��)�)� �1�1�1�3���$)�� �#(�� �#(�� �$%��!�#$�� ��$�$�&�"���#(�� �$%��!�#$�� ��%�%�'����!rc��||_t|d�rDt|tj�r*|j
|_|j|_d|_	yd|_	y)N�
get_bufferTF)
rC�hasattrrur�BufferedProtocolr��_app_protocol_get_buffer�buffer_updated�_app_protocol_buffer_updated�_app_protocol_is_buffer)r3r�s  rr?zSSLProtocol._set_app_protocolasP��)����L�,�/��<��)C�)C�D�,8�,C�,C�D�)�0<�0K�0K�D�-�+/�D�(�+0�D�(rc���|j�y|jj�s@|�#|jj|�d|_y|jjd�d|_yr>)r��	cancelled�
set_exception�
set_resultr�s  r�_wakeup_waiterzSSLProtocol._wakeup_waiterlsZ���<�<����|�|�%�%�'������*�*�3�/�������'�'��-���rc��|j�9|jrtd��t|j|�|_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)r�r�r�r.r0rDs rr�zSSLProtocol._get_app_transportvsJ�����&��*�*�"�#I�J�J�"7��
�
�D�"I�D��*.�D�'��"�"�"rc�2�||_|j�y)zXCalled when the low-level connection is made.

        Start the SSL handshake.
        N)r��_start_handshake)r3�	transports  r�connection_madezSSLProtocol.connection_made~s��
$������rc�H�|jj�|jj�|xjdz
c_|j
�d|j
_|jtjk7r|jtjk(s|jtjk(rEtj|_
|jj!|j"j$|�|j'tj(�d|_d|_d|_|j-|�|j.r!|j.j1�d|_|j2r"|j2j1�d|_yy)z�Called when the low-level connection is lost or closed.

        The argument is an exception object or None (the latter
        meaning a regular EOF is received or the connection was
        aborted or closed).
        rNT)r��clearr��readr�r�r2r�r
rr�rrrrr0�	call_soonrC�connection_lost�
_set_staterr�r��_shutdown_timeout_handle�cancel�_handshake_timeout_handler�s  rr�zSSLProtocol.connection_lost�s9��	
���!�!�#����������1������*�*.�D���'��;�;�*�7�7�7����#3�#B�#B�B����#3�#=�#=�=�"2�"A�"A����
�
�$�$�T�%7�%7�%G�%G��M����(�2�2�3����"���!������C� ��(�(��)�)�0�0�2�,0�D�)��)�)��*�*�1�1�3�-1�D�*�*rc���|}|dks||jkDr|j}t|j�|kr*t|�|_t	|j�|_|j
S�Nr)r�r�r�rwrxr�)r3�n�wants   rr�zSSLProtocol.get_buffer�s`�����1�9��t�}�}�,��=�=�D��t��� �4�'�(���D��$.�t�/?�/?�$@�D�!��$�$�$rc���|jj|jd|�|jtj
k(r|j
�y|jtjk(r|j�y|jtjk(r|j�y|jtjk(r|j�yyr>)
r�r~r�r�r
r�
_do_handshaker
�_do_readr�	_do_flushr�_do_shutdown)r3�nbytess  rr�zSSLProtocol.buffer_updated�s��������T�2�2�7�F�;�<��;�;�*�7�7�7���� �
�[�[�,�4�4�
4��M�M�O�
�[�[�,�5�5�
5��N�N��
�[�[�,�5�5�
5�����6rc���d|_	|jj�rtjd|�|j
tjk(r|jt�y|j
tjk(r=|jtj�|jry|j�y|j
tjk(r@|j�|jtj �|j#�y|j
tj k(r|j#�yy#t$$r|j&j)��wxYw)aCalled when the other end of the low-level stream
        is half-closed.

        If this returns a false value (including None), the transport
        will close itself.  If it returns a true value, closing the
        transport is up to the protocol.
        Tz%r received EOFN)r�r0�	get_debugr�debugr�r
r�_on_handshake_complete�ConnectionResetErrorr
r�rrQr��	_do_writerr��	Exceptionr�rJrDs r�eof_receivedzSSLProtocol.eof_received�s��"���	��z�z�#�#�%����.��5��{�{�.�;�;�;��+�+�,@�A���� 0� 8� 8�8���� 0� 9� 9�:��+�+���N�N�$���� 0� 9� 9�9���� ���� 0� 9� 9�:��!�!�#���� 0� 9� 9�9��!�!�#�:���	��O�O�!�!�#��	�s&�A"E�,AE�5E�AE�#-E�%E7c��||jvr|j|S|j�|jj||�S|Sr>)r�r�r<r9s   rr8zSSLProtocol._get_extra_info�sC���4�;�;���;�;�t�$�$�
�_�_�
(��?�?�1�1�$��@�@��Nrc�&�d}|tjk(rd}n�|jtjk(r|tjk(rd}n�|jtjk(r|tjk(rd}ne|jtjk(r|tj
k(rd}n2|jtj
k(r|tjk(rd}|r||_ytdj|j|���)NFTz!cannot switch state from {} to {})	r
rr�rr
rrr��format)r3�	new_state�alloweds   rr�zSSLProtocol._set_state�s������(�2�2�2��G�
�K�K�+�5�5�5��)�6�6�6��G�
�K�K�+�8�8�8��)�1�1�1��G�
�K�K�+�3�3�3��)�2�2�2��G�
�K�K�+�4�4�4��)�2�2�2��G��#�D�K��3�:�:��K�K��,�-�
-rc�n���jj�r6tjd���jj	��_nd�_�j
tj��jj�j�fd���_�j�y)Nz%r starts SSL handshakec�$���j�Sr>)�_check_handshake_timeoutrDs�r�<lambda>z.SSLProtocol._start_handshake.<locals>.<lambda>!s���$�*G�*G�*Ir)
r0r�rr��time�_handshake_start_timer�r
r�
call_laterr�r�r�rDs`rr�zSSLProtocol._start_handshakes�����:�:���!��L�L�2�D�9�)-�����):�D�&�)-�D�&����(�5�5�6�
�J�J�!�!�$�"=�"=�"I�
K�	
�&�	
���rc��|jtjk(r+d|j�d�}|j	t|��yy)Nz$SSL handshake is taking longer than z! seconds: aborting the connection)r�r
rr��_fatal_error�ConnectionAbortedError)r3�msgs  rr�z$SSLProtocol._check_handshake_timeout%sN���;�;�*�7�7�7�6��.�.�/�0*�+�
�

���4�S�9�:�
8rc���	|jj�|jd�y#t$r|j	�Yyt
j$r}|j|�Yd}~yd}~wwxYwr>)r��do_handshaker��SSLAgainErrors�_process_outgoingr�SSLErrorr�s  rr�zSSLProtocol._do_handshake.sb��	.��L�L�%�%�'�
�'�'��-���	%��"�"�$��|�|�	-��'�'��,�,��	-�s�.�A6�	A6�A1�1A6c���|j�!|jj�d|_|j}	|� |jtj
�n|�|j
�}|jj�rA|jj!�|j"z
}t%j&d||dz�|j(j+||j-�|j/�|��|j0t2j4k(r>t2j6|_|j8j;|j=��|j�|j?�y#t$rm}d}|jtj�t|tj�rd}nd}|j||�|j|�Yd}~yd}~wwxYw)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg@�@)�peercert�cipher�compression�
ssl_object) r�r�r�r�r
r
�getpeercertr�rrur�CertificateErrorr�r�r0r�r�r�rr�r��updaterrr�rrrrCr�r�r�)r3�
handshake_exc�sslobjrr�r��dts       rr�z"SSLProtocol._on_handshake_complete8s����)�)�5��*�*�1�1�3�-1�D�*�����	��$���� 0� 8� 8�9�#�#��)�)�+�H��:�:���!������"�T�%?�%?�?�B��L�L�9�4��c��J�	
�����H�"(�-�-�/�'-�'9�'9�';�&,�	�	.��?�?�.�9�9�9�.�=�=�D�O����.�.�t�/F�/F�/H�I������
�
���1�		� �M��O�O�,�6�6�7��#�s�3�3�4�I��,�����c�3�'�����$���		�s�4F�	G7�
A#G2�2G7c�����jtjtjtjfvry�j
�d�j
_�jtjk(r�jd�y�jtj��jj�j�fd���_
�j�y)NTc�$���j�Sr>)�_check_shutdown_timeoutrDs�rr�z-SSLProtocol._start_shutdown.<locals>.<lambda>rs����4�4�6r)r�r
rrrr�r2rr�r�r0r�r�r�r�rDs`rrIzSSLProtocol._start_shutdownas�����K�K� �)�)� �)�)� �*�*��
�
����*�*.�D���'��;�;�*�7�7�7��K�K����O�O�,�5�5�6�,0�J�J�,A�,A��*�*�6�-�D�)�
�N�N�rc��|jtjtjfvr/|jjt
jd��yy)NzSSL shutdown timed out)r�r
rrr�r�r�TimeoutErrorrDs rrz#SSLProtocol._check_shutdown_timeoutvsN���K�K� �)�)� �)�)��
�

�O�O�(�(��'�'�(@�A�
C�
rc��|j�|jtj�|j	�yr>)r�r�r
rr�rDs rr�zSSLProtocol._do_flush�s*���
�
�����(�1�1�2����rc�J�	|js|jj�|j�|j	�|jd�y#t$r|j�Yytj$r}|j|�Yd}~yd}~wwxYwr>)	r�r��unwrapr�_call_eof_received�_on_shutdown_completerrrr�s  rr�zSSLProtocol._do_shutdown�s���
	-��%�%����#�#�%�
�"�"�$��#�#�%��&�&�t�,���	%��"�"�$��|�|�	,��&�&�s�+�+��	,�s�&A�B"�5B"�B�B"c���|j�!|jj�d|_|r|j|�y|jj	|j
j�yr>)r�r�r�r0r�r�rJ)r3�shutdown_excs  rrz!SSLProtocol._on_shutdown_complete�sU���(�(�4��)�)�0�0�2�,0�D�)�����l�+��J�J� � ����!6�!6�7rc��|jtj�|j�|jj	|�yyr>)r�r
rr�r�r�s  rr�zSSLProtocol._abort�s6�����(�2�2�3��?�?�&��O�O�(�(��-�'rc�8�|jtjtjtjfvrH|j
tjk\rtjd�|xj
dz
c_y|D];}|jj|�|xjt|�z
c_�=	|jtjk(r|j�yy#t $r}|j#|d�Yd}~yd}~wwxYw)NzSSL connection is closedr�Fatal error on SSL protocol)r�r
rrrr�r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr�warningr�r�r�r�r
r�r�r�)r3r�r}�exs    rr{zSSLProtocol._write_appdata�s����K�K� �)�)� �)�)� �*�*��
����)�"M�"M�M����9�:��O�O�q� �O�� �D����&�&�t�,��#�#�s�4�y�0�#�!�	A��{�{�.�6�6�6���� �7���	A����b�"?�@�@��	A�s�-C4�4	D�=D�Dc�~�	|jr�|jd}|jj|�}t|�}||kr(||d|jd<|xj|zc_n"|jd=|xj|zc_|jr��|j
�y#t
$rY�wxYwr�)r�r�r~r�r�rr)r3r}�count�data_lens    rr�zSSLProtocol._do_write�s���	��%�%��*�*�1�-�����*�*�4�0���t�9���8�#�-1�%�&�\�D�'�'��*��+�+�u�4�+��+�+�A�.��+�+�x�7�+��%�%�	
��� ���	��	�s�BB0�0	B<�;B<c��|js@|jj�}t|�r|jj|�|j
�yr>)r�r�r�r�r�r~r[r|s  rrzSSLProtocol._process_outgoing�sB���'�'��>�>�&�&�(�D��4�y����%�%�d�+��!�!�#rc��|jtjtjfvry	|jsZ|j
r|j
�n|j�|jr|j�n|j�|j�y#t$r}|j|d�Yd}~yd}~wwxYw)Nr)r�r
r
rrQr��_do_read__buffered�_do_read__copiedr�r�rrhr�r�)r3r!s  rr�zSSLProtocol._do_read�s����K�K� �(�(� �)�)� �
�

�	A��+�+��/�/��+�+�-��)�)�+��&�&��N�N�$��*�*�,��%�%�'���	A����b�"?�@�@��	A�s�A6B&�&	C�/C�Cc����d}d}�j�j��}t|�}	�jj	||�}|dkDrY|}||kr4�jj	||z
||d�}|dkDr||z
}nn$||kr�4�j
j
�fd��|dkDr�j|�|s!�j��j�yy#t$rY�EwxYw)Nrrc�$���j�Sr>)r�rDs�rr�z0SSLProtocol._do_read__buffered.<locals>.<lambda>�s������r)r�ror�r�r�r0r�rr�rrI)r3�offsetr#�buf�wantss`    rr'zSSLProtocol._do_read__buffered�s���������+�+�D�,F�,F�,H�I���C���	��L�L�%�%�e�S�1�E��q�y����u�n� �L�L�-�-�e�f�n�c�&�'�l�K�E��q�y��%�����u�n��J�J�(�(�)@�A��A�:��-�-�f�5���#�#�%�� � �"���	�	��	�s�AC%�
C%�%	C1�0C1c��d}d}d}		|jj|j�}|sn$|rd}d}|}n|rd}|g}nj|��L	|r|j
j
�n,|s*|j
j
dj��|s!|j�|j�yy#t$rY�ywxYw)N�1TFr)
r�r�r�r�rrC�
data_received�joinrrI)r3�chunk�zero�one�firstr}s      rr(zSSLProtocol._do_read__copieds���������	�����)�)�$�-�-�8����� �D��C�!�E���C�!�5�>�D��K�K��&�������,�,�U�3�����,�,�S�X�X�d�^�<���#�#�%�� � �"���
�	��	�s�A
C�	C�Cc�>�	|jtjk(rHtj|_|jj�}|rt
jd�yyy#ttf$r�t$r}|j|d�Yd}~yd}~wwxYw)Nz?returning true from eof_received() has no effect when using sslzError calling eof_received())r�rrrrCr�rr �KeyboardInterrupt�
SystemExit�
BaseExceptionr�)r3�	keep_openr!s   rrzSSLProtocol._call_eof_received%s���
	B����"2�"A�"A�A�"2�"<�"<��� �.�.�;�;�=�	���N�N�$B�C��B��"�:�.�	���	B����b�"@�A�A��	B�s�A#A(�(B�B�Bc�Z�|j�}||jk\r/|js#d|_	|jj	�y||jkr0|jr#d|_	|jj�yyy#t
tf$r�t$r4}|jjd||j|d��Yd}~yd}~wwxYw#t
tf$r�t$r4}|jjd||j|d��Yd}~yd}~wwxYw)NTzprotocol.pause_writing() failed��message�	exceptionr�r@Fz protocol.resume_writing() failed)
rdr`rrrC�
pause_writingr7r8r9r0�call_exception_handlerr�r_�resume_writing)r3�sizer�s   rr[z SSLProtocol._control_app_writing4s$���*�*�,���4�,�,�,�T�5M�5M�'+�D�$�

��"�"�0�0�2��T�-�-�
-�$�2J�2J�',�D�$�

��"�"�1�1�3�3K�
-��&�z�2�
�� �
��
�
�1�1�@�!$�!%�!4�!4� $�	3����
��&�z�2�
�� �
��
�
�1�1�A�!$�!%�!4�!4� $�	3����
�s/�B�2C�C�'*C�C�D*�6*D%�%D*c�H�|jj|jzSr>)r��pendingr�rDs rrdz"SSLProtocol._get_write_buffer_sizeQs���~�~�%�%��(?�(?�?�?rc�\�t||tj�\}}||_||_yr>)r,r�!FLOW_CONTROL_HIGH_WATER_SSL_WRITEr`r_r\s   rrZz$SSLProtocol._set_write_buffer_limitsTs.��,��#�y�B�B�D�	��c�$(��!�#&�� rc��d|_yr�)rQrDs rrTzSSLProtocol._pause_reading\s
��#'�� rc�n���jr(d�_�fd�}�jj|�yy)NFc����jtjk(r�j�y�jtjk(r�j�y�jtjk(r�j�yyr>)r�r
r
r�rr�rr�rDs�r�resumez+SSLProtocol._resume_reading.<locals>.resumecs`����;�;�"2�":�":�:��M�M�O��[�[�$4�$=�$=�=��N�N�$��[�[�$4�$=�$=�=��%�%�'�>r)rQr0r�)r3rJs` rrWzSSLProtocol._resume_reading_s2����#�#�',�D�$�
(�
�J�J� � ��(�$rc��|j�}||jk\r.|js"d|_|jj	�y||j
kr/|jr"d|_|jj
�yyy)NTF)rorlr�r�rUrkrX)r3rBs  rrhz SSLProtocol._control_ssl_readingnsu���)�)�+���4�,�,�,�T�5M�5M�'+�D�$��O�O�)�)�+�
�T�-�-�
-�$�2J�2J�',�D�$��O�O�*�*�,�3K�
-rc�\�t||tj�\}}||_||_yr>)r,r� FLOW_CONTROL_HIGH_WATER_SSL_READrlrkr\s   rrgz#SSLProtocol._set_read_buffer_limitsws.��,��#�y�A�A�C�	��c�$(��!�#&�� rc�.�|jjSr>)r�rDrDs rroz!SSLProtocol._get_read_buffer_size}s���~�~�%�%�%rc�.�|jrJ�d|_y)z\Called when the low-level transport's buffer goes over
        the high-water mark.
        TN)r�rDs rr?zSSLProtocol.pause_writing�s���+�+�+�+�#'�� rc�N�|jsJ�d|_|j�y)z^Called when the low-level transport's buffer drains below
        the low-water mark.
        FN)r�rrDs rrAzSSLProtocol.resume_writing�s'���'�'�'�'�#(�� ���� rc�f�|jr|jj|�t|t�r5|jj�rt
jd||d��yyt|tj�s+|jj|||j|d��yy)Nz%r: %sT)�exc_infor<)r�r�ru�OSErrorr0r�rr�r�CancelledErrorr@)r3r�r=s   rr�zSSLProtocol._fatal_error�s����?�?��O�O�(�(��-��c�7�#��z�z�#�#�%����X�t�W�t�D�&��C��!:�!:�;��J�J�-�-�"� �!�_�_� �	/�
�<r)FNTNNr>r�)zFatal error on transport).rrrr�r�r�r�r6r?r�r�r�r�r�r�r�r8r�r�r�r�r�rIrr�r�rr�r{r�rr�r'r(rr[rdrZrTrWrhrgror?rAr�rrrr�r�s����H� �� $��#��59�&*�'+�&*�	Q"�f	1��#� �"2�H%�
 �!�F�$-�P� ;�.�%�R�*C��
-�8�.�A�0!� $�A�,#�:#�<B��:@�'�(�)�-�'�&�
(�!�
rr�)r��enumr�r�ImportError�rrrr�logr�SSLWantReadError�SSLSyscallErrorr�Enumr
rr$r,�_FlowControlMixin�	Transportr.r�r�rrr�<module>r^s���
�����������?��*�*�C�,?�,?�@�N��t�y�y��
&�t�y�y�
&� ��*r;�J�8�8�&�0�0�r;�jW
�)�,�,�W
��{��
�C��s�B0�0B:�9B: