AlkantarClanX12

Your IP : 3.147.73.85


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/asyncio/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/asyncio/__pycache__/sslproto.cpython-311.pyc

�

c��f�{��P�ddlZddlZddlZ	ddlZn
#e$rdZYnwxYwddlmZddlmZddlmZddlm	Z	ddl
mZe�ejej
fZGd�d	ej��ZGd
�dej��Zd�Zd
�ZGd�de	je	j��ZGd�dej��ZdS)�N�)�	constants)�
exceptions)�	protocols)�
transports)�loggerc�"�eZdZdZdZdZdZdZdS)�SSLProtocolState�	UNWRAPPED�DO_HANDSHAKE�WRAPPED�FLUSHING�SHUTDOWNN)�__name__�
__module__�__qualname__rrr
rr���7/opt/alt/python311/lib64/python3.11/asyncio/sslproto.pyr
r
s'�������I�!�L��G��H��H�H�Hrr
c��eZdZdZdZdZdZdS)�AppProtocolState�
STATE_INIT�STATE_CON_MADE�	STATE_EOF�STATE_CON_LOSTN)rrrrrrrrrrrrs$�������J�%�N��I�%�N�N�Nrrc�`�|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$/s@���E��C�D�D�D��+�-�-�J��*�$)�
�!��rc��|�|�|dz}n
|}d|z}n|}|�|dz}n|}||cxkrdksntd|�d|�d����||fS)Ni�rzhigh (z) must be >= low (z) must be >= 0)r)�high�low�kb�hi�los     r�add_flowcontrol_defaultsr,=s����|��;��d��B�B��B��R��B�B�
��
�{�
�1�W���
��
��=�=�=�=�q�=�=�=�=��j��"�"�b�b�b�"�#�#�	#��r�6�Mrc���eZdZdZejjZd�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!dS)�_SSLProtocolTransportTc�0�||_||_d|_dS)NF)�_loop�
_ssl_protocol�_closed)�self�loop�ssl_protocols   r�__init__z_SSLProtocolTransport.__init__Xs����
�)�������rNc�8�|j�||��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�:�|j�|��dS�N)r1�_set_app_protocol)r3�protocols  r�set_protocolz"_SSLProtocolTransport.set_protocolas����,�,�X�6�6�6�6�6rc��|jjSr>)r1�
_app_protocol�r3s r�get_protocolz"_SSLProtocolTransport.get_protocolds���!�/�/rc��|jSr>)r2rDs r�
is_closingz _SSLProtocolTransport.is_closinggs
���|�rc�f�|js"d|_|j���dSd|_dS)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�0�0�0�0�!%�D���rc�\�|js$d|_|�dt��dSdS)NTz9unclosed transport <asyncio._SSLProtocolTransport object>)r2�warn�ResourceWarning)r3�	_warningss  r�__del__z_SSLProtocolTransport.__del__xsE���|�	,��D�L��N�N��*�
,�
,�
,�
,�
,�	,�	,rc��|jjSr>)r1�_app_reading_pausedrDs r�
is_readingz _SSLProtocolTransport.is_readings���%�9�9�9rc�8�|j���dS)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�|j���dS)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�n�|j�||��|j���dS)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�s8��&	
��3�3�D�#�>�>�>���/�/�1�1�1�1�1rc�2�|jj|jjfSr>)r1�_outgoing_low_water�_outgoing_high_waterrDs r�get_write_buffer_limitsz-_SSLProtocolTransport.get_write_buffer_limits�����"�6��"�7�9�	9rc�4�|j���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�n�|j�||��|j���dS)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�s8��&	
��2�2�4��=�=�=���/�/�1�1�1�1�1rc�2�|jj|jjfSr>)r1�_incoming_low_water�_incoming_high_waterrDs r�get_read_buffer_limitsz,_SSLProtocolTransport.get_read_buffer_limits�rbrc�4�|j���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�9�9rc��|jjSr>)r1�_app_writing_pausedrDs r�_protocol_pausedz&_SSLProtocolTransport._protocol_paused�s���!�5�5rc���t|tttf��s$t	dt|��j�����|sdS|j�|f��dS)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�sv���$��	�:� >�?�?�	:��9�#'��:�:�#6�9�9�:�:�
:��	��F���)�)�4�'�2�2�2�2�2rc�:�|j�|��dS)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!��	
��)�)�,�7�7�7�7�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��dS)zAReturn True if this transport supports write_eof(), False if not.FrrDs r�
can_write_eofz#_SSLProtocolTransport.can_write_eof�s���urc�0�|�d��dS)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�Z�d|_|j�|j�|��dSdS�NT)r2r1�_abort�r3�excs  rr�z"_SSLProtocolTransport._force_close�s7�������)���%�%�c�*�*�*�*�*�*�)rc��|jj�|��|jxjt	|��z
c_dSr>)r1�_write_backlog�append�_write_buffer_size�lenr|s  r�_test__append_write_backlogz1_SSLProtocolTransport._test__append_write_backlogs?����)�0�0��6�6�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�;�����
A�A�A�A�7�7�7�0�0�0����&�&�&�!)�,�,�,�,�:�:�:�,�,�,�-�-�-�2�2�2�2�,9�9�9�;�;�;�2�2�2�2�,9�9�9�:�:�:��6�6��X�6�3�3�3�8�8�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,d0d,�Z-dS)1�SSLProtocoliNFTc
���t�td���t|j��|_t|j��|_|�
tj}n|dkrtd|�����|	�
tj
}	n|	dkrtd|	�����|st||��}||_|r
|s||_
nd|_
||_t|���|_t#j��|_d|_||_||_|�|��d|_d|_d|_||_|	|_tj��|_tj��|_t@j!|_"d|_#|rtHj%|_&ntHj'|_&|j�(|j|j|j|j
���|_)d|_*d|_+d|_,d|_-d|_.|�/��d|_0d|_1d|_2d|_3|�4��|�5��dS)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__s���
�;��@�A�A�A�$�T�]�3�3��� *�4�+;� <� <��� �(�$-�$C�!�!�
"�a�
'�
'��/�,�/�/�0�0�
0� �'�#,�#A� � �
!�Q�
&�
&��.�+�.�.�/�/�
/��	.�2��_�.�.�J�(����	)�;�	)�$3�D�!�!�$(�D�!�%����j�1�1�1���*�/�1�1���"#��������
����|�,�,�,�"���&+��#����&;��#�%9��"�������������&�0�������	>�.�9�D�O�O�.�=�D�O��'�0�0��N�D�N��)� �1�1�3�3���$)�� �#(�� �#(�� �$%��!�#$�� ��$�$�&�&�&�"���#(�� �$%��!�#$�� ��%�%�'�'�'����!�!�!�!�!rc��||_t|d��r;t|tj��r!|j|_|j|_d|_	dSd|_	dS)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_protocolasc��)����L�,�/�/�	1��<��)C�D�D�	1�,8�,C�D�)�0<�0K�D�-�+/�D�(�(�(�+0�D�(�(�(rc���|j�dS|j���s7|�|j�|��n|j�d��d|_dSr>)r��	cancelled�
set_exception�
set_resultr�s  r�_wakeup_waiterzSSLProtocol._wakeup_waiterlsd���<���F��|�%�%�'�'�	.�����*�*�3�/�/�/�/���'�'��-�-�-�����rc��|j�7|jrtd���t|j|��|_d|_|jS)Nz$Creating _SSLProtocolTransport twiceT)r�r�r�r.r0rDs rr�zSSLProtocol._get_app_transportvsK����&��*�
K�"�#I�J�J�J�"7��
�D�"I�"I�D��*.�D�'��"�"rc�<�||_|���dS)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���|j���|j���|xjdz
c_|j�d|j_|jtj	kr`|j
tjks|j
tj
kr6tj|_
|j�|jj|��|�tj��d|_d|_d|_|�|��|jr |j���d|_|jr"|j���d|_dSdS)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�sO��	
��!�!�#�#�#�����������1������*�*.�D��'��;�*�7�7�7���#3�#B�B�B���#3�#=�=�=�"2�"A����
�$�$�T�%7�%G��M�M�M����(�2�3�3�3����"���!������C� � � ��(�	1��)�0�0�2�2�2�,0�D�)��)�	2��*�1�1�3�3�3�-1�D�*�*�*�	2�	2rc���|}|dks||jkr|j}t|j��|kr-t|��|_t	|j��|_|jS�Nr)r�r�r�rwrxr�)r3�n�wants   rr�zSSLProtocol.get_buffer�sc�����1�9�9��t�}�,�,��=�D��t�� � �4�'�'�(����D��$.�t�/?�$@�$@�D�!��$�$rc��|j�|jd|���|jtjkr|���dS|jtjkr|���dS|jtj	kr|�
��dS|jtjkr|���dSdSr>)
r�r~r�r�r
r�
_do_handshaker
�_do_readr�	_do_flushr�_do_shutdown)r3�nbytess  rr�zSSLProtocol.buffer_updated�s�������T�2�7�F�7�;�<�<�<��;�*�7�7�7���� � � � � �
�[�,�4�
4�
4��M�M�O�O�O�O�O�
�[�,�5�
5�
5��N�N������
�[�,�5�
5�
5���������6�
5rc���d|_	|j���rtjd|��|jtjkr|�t��dS|jtj
kr>|�tj��|j
rdS|���dS|jtjkrI|���|�tj��|���dS|jtjkr|���dSdS#t$$r|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�sg��"���	��z�#�#�%�%�
6���.��5�5�5��{�.�;�;�;��+�+�,@�A�A�A�A�A��� 0� 8�8�8���� 0� 9�:�:�:��+�%��4��N�N�$�$�$�$�$��� 0� 9�9�9���� � � ���� 0� 9�:�:�:��!�!�#�#�#�#�#��� 0� 9�9�9��!�!�#�#�#�#�#�:�9���	�	�	��O�!�!�#�#�#��	���s%�AE�(;E�%E�;AE�)E�%E+c�v�||jvr
|j|S|j�|j�||��S|Sr>)r�r�r<r9s   rr8zSSLProtocol._get_extra_info�sA���4�;����;�t�$�$�
�_�
(��?�1�1�$��@�@�@��Nrc���d}|tjkrd}n�|jtjkr|tjkrd}nw|jtjkr|tjkrd}nO|jtjkr|tjkrd}n'|jtjkr|tjkrd}|r	||_dStd�|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�G�
�K�+�5�5�5��)�6�6�6��G�G�
�K�+�8�8�8��)�1�1�1��G�G�
�K�+�3�3�3��)�2�2�2��G�G�
�K�+�4�4�4��)�2�2�2��G��	-�#�D�K�K�K��3�:�:��K��,�,�-�-�
-rc�f���j���r4tjd����j����_nd�_��tj���j�	�j
�fd����_����dS)Nz%r starts SSL handshakec�,������Sr>)�_check_handshake_timeoutrDs�r�<lambda>z.SSLProtocol._start_handshake.<locals>.<lambda>!s���$�*G�*G�*I�*I�r)
r0r�rr��time�_handshake_start_timer�r
r�
call_laterr�r�r�rDs`rr�zSSLProtocol._start_handshakes�����:���!�!�	.��L�2�D�9�9�9�)-����):�):�D�&�&�)-�D�&����(�5�6�6�6�
�J�!�!�$�"=�"I�"I�"I�"I�
K�
K�	
�&�	
�������rc��|jtjkr/d|j�d�}|�t|����dSdS)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%s_���;�*�7�7�7�+��.�+�+�+�
�

���4�S�9�9�:�:�:�:�:�
8�7rc��	|j���|�d��dS#t$r|���YdSt
j$r }|�|��Yd}~dSd}~wwxYwr>)r��do_handshaker��SSLAgainErrors�_process_outgoingr�SSLErrorr�s  rr�zSSLProtocol._do_handshake.s���	.��L�%�%�'�'�'�
�'�'��-�-�-�-�-���	%�	%�	%��"�"�$�$�$�$�$�$��|�	-�	-�	-��'�'��,�,�,�,�,�,�,�,�,�����	-���s�2�B�B�!A<�<Bc��|j� |j���d|_|j}	|� |�tj��n|�|���}n�#t$rv}d}|�tj��t|tj��rd}nd}|�||��|�
|��Yd}~dSd}~wwxYw|j���r:|j���|jz
}t%jd||dz��|j�||���|���|���|jt2jkr=t2j|_|j�|�����|�
��|���dS)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�3�3�-1�D�*����	��$���� 0� 8�9�9�9�9�#�#��)�)�+�+�H�H���		�		�		� �M��O�O�,�6�7�7�7��#�s�3�4�4�
-�I���,�����c�3�'�'�'�����$�$�$��F�F�F�F�F�����		�����:���!�!�	K�����"�"�T�%?�?�B��L�9�4��c��J�J�J�	
����H�"(�-�-�/�/�'-�'9�'9�';�';�&,�	�	.�	.�	.��?�.�9�9�9�.�=�D�O���.�.�t�/F�/F�/H�/H�I�I�I��������
�
�����s�8A)�)
C)�3A+C$�$C)c����jtjtjtjfvrdS�j�d�j_�jtjkr��d��dS��	tj���j
��j�fd����_
����dS)NTc�,������Sr>)�_check_shutdown_timeoutrDs�rr�z-SSLProtocol._start_shutdown.<locals>.<lambda>rs����4�4�6�6�r)r�r
rrrr�r2rr�r�r0r�r�r�r�rDs`rrIzSSLProtocol._start_shutdownas�����K� �)� �)� �*��
�
�
�F���*�*.�D��'��;�*�7�7�7��K�K��������O�O�,�5�6�6�6�,0�J�,A�,A��*�6�6�6�6�-�-�D�)�
�N�N�����rc��|jtjtjfvr.|j�t
jd����dSdS)NzSSL shutdown timed out)r�r
rrr�r�r�TimeoutErrorrDs rrz#SSLProtocol._check_shutdown_timeoutvsf���K� �)� �)��
�
�

�O�(�(��'�(@�A�A�
C�
C�
C�
C�
C�
�
rc��|���|�tj��|���dSr>)r�r�r
rr�rDs rr�zSSLProtocol._do_flush�s=���
�
�������(�1�2�2�2��������rc�f�	|js|j���|���|���|�d��dS#t$r|���YdStj$r }|�|��Yd}~dSd}~wwxYwr>)	r�r��unwrapr�_call_eof_received�_on_shutdown_completerrrr�s  rr�zSSLProtocol._do_shutdown�s���
	-��%�
&���#�#�%�%�%�
�"�"�$�$�$��#�#�%�%�%��&�&�t�,�,�,�,�,���	%�	%�	%��"�"�$�$�$�$�$�$��|�	,�	,�	,��&�&�s�+�+�+�+�+�+�+�+�+�����	,���s� A!�!B0�B0�B+�+B0c���|j� |j���d|_|r|�|��dS|j�|jj��dSr>)r�r�r�r0r�r�rJ)r3�shutdown_excs  rrz!SSLProtocol._on_shutdown_complete�sk���(�4��)�0�0�2�2�2�,0�D�)��	8����l�+�+�+�+�+��J� � ���!6�7�7�7�7�7rc��|�tj��|j�|j�|��dSdSr>)r�r
rr�r�r�s  rr�zSSLProtocol._abort�sD�����(�2�3�3�3��?�&��O�(�(��-�-�-�-�-�'�&rc��|jtjtjtjfvr;|jtjkrtj	d��|xjdz
c_dS|D]9}|j
�|��|xjt|��z
c_�:	|jtjkr|���dSdS#t $r!}|�|d��Yd}~dSd}~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� �)� �)� �*��
�
���)�"M�M�M���9�:�:�:��O�O�q� �O�O��F� �	1�	1�D���&�&�t�,�,�,��#�#�s�4�y�y�0�#�#�#�	A��{�.�6�6�6���� � � � � �7�6���	A�	A�	A����b�"?�@�@�@�@�@�@�@�@�@�����	A���s�#)C�
C;�C6�6C;c�\�	|jr~|jd}|j�|��}t|��}||kr#||d�|jd<|xj|zc_n|jd=|xj|zc_|j�~n#t
$rYnwxYw|���dSr�)r�r�r~r�r�rr)r3r}�count�data_lens    rr�zSSLProtocol._do_write�s���	��%�	
8��*�1�-����*�*�4�0�0���t�9�9���8�#�#�-1�%�&�&�\�D�'��*��+�+�u�4�+�+�+��+�A�.��+�+�x�7�+�+��%�	
8����	�	�	��D�	������� � � � � s�BB�
B�Bc��|jsB|j���}t|��r|j�|��|���dSr>)r�r�r�r�r�r~r[r|s  rrzSSLProtocol._process_outgoing�s\���'�	,��>�&�&�(�(�D��4�y�y�
,���%�%�d�+�+�+��!�!�#�#�#�#�#rc��|jtjtjfvrdS	|js`|jr|���n|���|jr|�	��n|�
��|���dS#t$r!}|�
|d��Yd}~dSd}~wwxYw)Nr)r�r
r
rrQr��_do_read__buffered�_do_read__copiedr�r�rrhr�r�)r3r!s  rr�zSSLProtocol._do_read�s���K� �(� �)� �
�
�

�F�	A��+�
-��/�,��+�+�-�-�-�-��)�)�+�+�+��&�-��N�N�$�$�$�$��*�*�,�,�,��%�%�'�'�'�'�'���	A�	A�	A����b�"?�@�@�@�@�@�@�@�@�@�����	A���s�A;B � 
C�*C�Cc�,��d}d}��������}t|��}	�j�||��}|dkr^|}||kr9�j�||z
||d���}|dkr||z
}nn#||k�9�j��fd���n#t$rYnwxYw|dkr��|��|s*��	����
��dSdS)Nrrc�,������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�sK��������+�+�D�,F�,F�,H�,H�I�I���C����	��L�%�%�e�S�1�1�E��q�y�y����u�n�n� �L�-�-�e�f�n�c�&�'�'�l�K�K�E��q�y�y��%������u�n�n��J�(�(�)@�)@�)@�)@�A�A�A����	�	�	��D�	�����A�:�:��-�-�f�5�5�5��	#��#�#�%�%�%�� � �"�"�"�"�"�	#�	#s�A?B=�=
C
�	C
c��d}d}d}		|j�|j��}|sn(|rd}d}|}n|rd}||g}n|�|���Jn#t$rYnwxYw|r|j�|��n/|s-|j�d�|����|s*|���|�	��dSdS)N�1TFr)
r�r�r�r�rrC�
data_received�joinrrI)r3�chunk�zero�one�firstr}s      rr(zSSLProtocol._do_read__copieds3��������	�
'���)�)�$�-�8�8������'� �D��C�!�E�E��'��C�!�5�>�D�D��K�K��&�&�&�
'����	�	�	��D�	�����	=���,�,�U�3�3�3�3��	=���,�,�S�X�X�d�^�^�<�<�<��	#��#�#�%�%�%�� � �"�"�"�"�"�	#�	#s�AA�
A!� A!c�8�	|jtjkrBtj|_|j���}|rt
jd��dSdSdS#ttf$r�t$r!}|�|d��Yd}~dSd}~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�"<��� �.�;�;�=�=�	��C��N�$B�C�C�C�C�C�	B�A�C�C��"�:�.�	�	�	���	B�	B�	B����b�"@�A�A�A�A�A�A�A�A�A�����	B���s�AA�B�8B�Bc�:�|���}||jkrw|jspd|_	|j���dS#t
tf$r�t$r/}|j�	d||j
|d���Yd}~dSd}~wwxYw||jkrw|jrrd|_	|j���dS#t
tf$r�t$r/}|j�	d||j
|d���Yd}~dSd}~wwxYwdSdS)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�,�'+�D�$�

��"�0�0�2�2�2�2�2��%�z�2�
�
�
�� �
�
�
��
�1�1�@�!$�!%�!4� $�	3�3��������������
�����T�-�
-�
-�$�2J�
-�',�D�$�

��"�1�1�3�3�3�3�3��%�z�2�
�
�
�� �
�
�
��
�1�1�A�!$�!%�!4� $�	3�3��������������
����
.�
-�
-�
-s/�A
�
B�%$B�B�1C�D�'$D�Dc�*�|jj|jzSr>)r��pendingr�rDs rrdz"SSLProtocol._get_write_buffer_sizeQs���~�%��(?�?�?rc�^�t||tj��\}}||_||_dSr>)r,r�!FLOW_CONTROL_HIGH_WATER_SSL_WRITEr`r_r\s   rrZz$SSLProtocol._set_write_buffer_limitsTs7��,��#�y�B�D�D�	��c�$(��!�#&�� � � rc��d|_dSr�)rQrDs rrTzSSLProtocol._pause_reading\s��#'�� � � rc�f���jr(d�_�fd�}�j�|��dSdS)NFc�
���jtjkr����dS�jtjkr����dS�jtjkr����dSdSr>)r�r
r
r�rr�rr�rDs�r�resumez+SSLProtocol._resume_reading.<locals>.resumecs}����;�"2�":�:�:��M�M�O�O�O�O�O��[�$4�$=�=�=��N�N�$�$�$�$�$��[�$4�$=�=�=��%�%�'�'�'�'�'�>�=r)rQr0r�)r3rJs` rrWzSSLProtocol._resume_reading_sW����#�
	)�',�D�$�
(�
(�
(�
(�
(�
�J� � ��(�(�(�(�(�
	)�
	)rc��|���}||jkr)|js"d|_|j���dS||jkr)|jr$d|_|j���dSdSdS)NTF)rorlr�r�rUrkrX)r3rBs  rrhz SSLProtocol._control_ssl_readingns����)�)�+�+���4�,�,�,�T�5M�,�'+�D�$��O�)�)�+�+�+�+�+�
�T�-�
-�
-�$�2J�
-�',�D�$��O�*�*�,�,�,�,�,�.�
-�
-�
-rc�^�t||tj��\}}||_||_dSr>)r,r� FLOW_CONTROL_HIGH_WATER_SSL_READrlrkr\s   rrgz#SSLProtocol._set_read_buffer_limitsws7��,��#�y�A�C�C�	��c�$(��!�#&�� � � rc��|jjSr>)r�rDrDs rroz!SSLProtocol._get_read_buffer_size}s
���~�%�%rc�&�|jrJ�d|_dS)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|_|���dS)z^Called when the low-level transport's buffer drains below
        the low-water mark.
        FN)r�rrDs rrAzSSLProtocol.resume_writing�s3���'�'�'�'�#(�� ���� � � � � r�Fatal error on transportc�\�|jr|j�|��t|t��r5|j���rt
jd||d���dSdSt|tj	��s&|j�
|||j|d���dSdS)Nz%r: %sT)�exc_infor<)r�r�ru�OSErrorr0r�rr�r�CancelledErrorr@)r3r�r=s   rr�zSSLProtocol._fatal_error�s����?�	.��O�(�(��-�-�-��c�7�#�#�		��z�#�#�%�%�
E���X�t�W�t�D�D�D�D�D�D�
E�
E��C��!:�;�;�	��J�-�-�"� �!�_� �	/�/�
�
�
�
�
�	�	r)FNTNNr>r�)rQ).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"�Q"�Q"�Q"�f	1�	1�	1�����#�#�#� � � �"2�"2�"2�H%�%�%�
 �
 �
 �!�!�!�F����$-�$-�$-�P��� ;�;�;�.�.�.�%�%�%�R���*C�C�C����
-�-�-�8�8�8�.�.�.�A�A�A�0!�!�!� $�$�$�A�A�A�,#�#�#�:#�#�#�<B�B�B����:@�@�@�'�'�'�'�(�(�(�)�)�)�-�-�-�'�'�'�'�&�&�&�
(�(�(�!�!�!�
�
�
�
�
�
rr�)r��enumr�r�ImportError�rrrr�logr�SSLWantReadError�SSLSyscallErrorr�Enumr
rr$r,�_FlowControlMixin�	Transportr.r�r�rrr�<module>r_s���
��������������J�J�J�J������
�C�C�C������������������������������������?��*�C�,?�@�N������t�y����
&�
&�
&�
&�
&�t�y�
&�
&�
&� ������*r;�r;�r;�r;�r;�J�8�&�0�r;�r;�r;�jW
�W
�W
�W
�W
�)�,�W
�W
�W
�W
�W
s���