AlkantarClanX12

Your IP : 18.223.195.127


Current Path : /opt/alt/python311/lib64/python3.11/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/asyncio/__pycache__/selector_events.cpython-311.opt-2.pyc

�

c��fX���l�	dZddlZddlZddlZddlZddlZddlZddlZ	ddlZn
#e	$rdZYnwxYwddl
mZddl
mZddl
m
Z
ddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddlmZd
�ZGd�dej��ZGd�dejej��ZGd�de��ZGd�de��ZdS))�BaseSelectorEventLoop�N�)�base_events)�	constants)�events)�futures)�	protocols)�sslproto)�
transports)�trsock)�loggerc�~�	|�|��}t|j|z��S#t$rYdSwxYw�NF)�get_key�boolr�KeyError)�selector�fd�event�keys    �>/opt/alt/python311/lib64/python3.11/asyncio/selector_events.py�_test_selector_eventr sU��(����r�"�"���C�J��&�'�'�'�������u�u����s�.�
<�<c����eZdZ	d3�fd�	Zd3ddd�d�Z	d3ddddejejd�d�Z	d4d�Z	�fd	�Z
d
�Zd�Zd�Z
d
�Zd�Zdddejejfd�Zdddejejfd�Zddejejfd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd3d�Zd�Zd�Zd �Z d!�Z!d"�Z"d5d$�Z#d%�Z$d&�Z%d'�Z&d(�Z'd)�Z(d*�Z)d+�Z*d3d,�Z+d-�Z,d.�Z-d/�Z.d0�Z/d1�Z0d2�Z1�xZ2S)6rNc���t�����|�tj��}t	jd|jj��||_|�	��tj��|_dS)NzUsing selector: %s)
�super�__init__�	selectors�DefaultSelectorr
�debug�	__class__�__name__�	_selector�_make_self_pipe�weakref�WeakValueDictionary�_transports)�selfrr s  �rrzBaseSelectorEventLoop.__init__1sv���
���������� �0�2�2�H���)�8�+=�+F�G�G�G�!���������"�6�8�8�������extra�serverc�*�t||||||��S�N)�_SelectorSocketTransport)r'�sock�protocol�waiterr*r+s      r�_make_socket_transportz,BaseSelectorEventLoop._make_socket_transport;s!��'��d�H�f�(-�v�7�7�	7r(F)�server_side�server_hostnamer*r+�ssl_handshake_timeout�ssl_shutdown_timeoutc
�p�tj|||||||	|
���}t|||||���|jS)N)r5r6r))r
�SSLProtocolr.�_app_transport)r'�rawsockr0�
sslcontextr1r3r4r*r+r5r6�ssl_protocols            r�_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transport@s\�� �+��(�J����"7�!5�	
�
�
��	!��w��',�V�	=�	=�	=�	=��*�*r(c�*�t||||||��Sr-)�_SelectorDatagramTransport)r'r/r0�addressr1r*s      r�_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transportQs$��)�$��h�*1�6�5�B�B�	Br(c�4��|���rtd���|���rdS|���t	�����|j�"|j���d|_dSdS)Nz!Cannot close a running event loop)�
is_running�RuntimeError�	is_closed�_close_self_piper�closer")r'r s �rrGzBaseSelectorEventLoop.closeVs�����?�?���	D��B�C�C�C��>�>���	��F�������
���
�
�����>�%��N� � �"�"�"�!�D�N�N�N�&�%r(c��|�|j�����|j���d|_|j���d|_|xjdzc_dS)Nr)�_remove_reader�_ssock�filenorG�_csock�
_internal_fds�r's rrFz&BaseSelectorEventLoop._close_self_pipeast�����D�K�.�.�0�0�1�1�1������������������������a�����r(c�2�tj��\|_|_|j�d��|j�d��|xjdz
c_|�|j���|j��dS)NFr)	�socket�
socketpairrJrL�setblockingrM�_add_readerrK�_read_from_selfrNs rr#z%BaseSelectorEventLoop._make_self_pipeis���#)�#4�#6�#6� ���T�[������&�&�&������&�&�&����a���������+�+�-�-�t�/C�D�D�D�D�Dr(c��dSr-��r'�datas  r�_process_self_dataz(BaseSelectorEventLoop._process_self_dataqs���r(c��		|j�d��}|sdS|�|��n#t$rY�Bt$rYdSwxYw�R)NTi)rJ�recvrY�InterruptedError�BlockingIOErrorrWs  rrTz%BaseSelectorEventLoop._read_from_selfts���		�
��{�'�'��-�-�����E��'�'��-�-�-�-��#�
�
�
���"�
�
�
����
����		s�7�7�
A�	A�Ac��|j}|�dS	|�d��dS#t$r$|jrt	jdd���YdSYdSwxYw)N�z3Fail to write a null byte into the self-pipe socketT��exc_info)rL�send�OSError�_debugr
r)r'�csocks  r�_write_to_selfz$BaseSelectorEventLoop._write_to_self�s�������=��F�	,��J�J�u��������	,�	,�	,��{�
,���0�&*�,�,�,�,�,�,�,�
,�
,�
,�	,���s�$�'A�A�dc�n�|�|���|j|||||||�	�	dSr-)rSrK�_accept_connection)r'�protocol_factoryr/r;r+�backlogr5r6s        r�_start_servingz$BaseSelectorEventLoop._start_serving�sK��	
���������(?�)�4��V�W�.�0D�	F�	F�	F�	F�	Fr(c
��t|��D�]h}	|���\}	}
|jrtjd||
|	��|	�d��d|
i}|�||	|||||��}|�|����#tttf$rYdSt$r�}
|
jtj
tjtjtjfvr|�d|
t%j|��d���|�|�����|�t.j|j|||||||�	�	n�Yd}
~
��bd}
~
wwxYwdS)Nz#%r got a new connection from %r: %rF�peernamez&socket.accept() out of system resource)�message�	exceptionrP)�range�acceptrdr
rrR�_accept_connection2�create_taskr]r\�ConnectionAbortedErrorrc�errno�EMFILE�ENFILE�ENOBUFS�ENOMEM�call_exception_handlerr�TransportSocketrIrK�
call_laterr�ACCEPT_RETRY_DELAYrl)r'rjr/r;r+rkr5r6�_�conn�addrr*rr�excs              rriz(BaseSelectorEventLoop._accept_connection�s����w���#	)�#	)�A�"
)�!�[�[�]�]�
��d��;�5��L�!F�!'��t�5�5�5�� � ��'�'�'�2$�T�*���1�1�$�d�E�:�v�)�+?�A�A��� � ��(�(�(�(��9$�%5�7M�N�
�
�
��t�t�t��
�
�
��9���u�|�!&����!>�>�>�
�/�/�#K�%(�"(�"8��">�">�1�1����
�'�'����
�
�6�6�6��O�O�I�$@�$(�$7�$4�d�J��$+�-B�$8�	:�:�:�:��
:�:�:�:�:�����
����#	)�#	)s�A
B�E7�.	E7�7B5E2�2E7c���K�d}d}		|��}|���}
|r|�||||
d||||��	�	}	n|�|||
||���}		|
�d{V��dS#t$r|	���d}
�wxYw#t
tf$r�t$r@}|jr.d|d�}|�||d<|	�|	|d<|�|��Yd}~dSYd}~dSd}~wwxYw)NT)r1r3r*r+r5r6)r1r*r+z3Error on transport creation for incoming connection)rorpr0�	transport)	�
create_futurer=r2�
BaseExceptionrG�
SystemExit�KeyboardInterruptrdr{)
r'rjr�r*r;r+r5r6r0r�r1r��contexts
             rrsz)BaseSelectorEventLoop._accept_connection2�s�����
���	�&	5�'�'�)�)�H��'�'�)�)�F��	
#� �4�4��(�J�v� $�E�&�*?�)=�	5�?�?�	�	�!�7�7��(�6��!�8�#�#�	�
������������ �
�
�
����!�!�!����

������-�.�	�	�	���	5�	5�	5��{�

5�N�!$����
�'�*2�G�J�'��(�+4�G�K�(��+�+�G�4�4�4�4�4�4�4�4�4�

5�

5�

5�

5�

5�

5�����	5���s*�AB�"A,�,"B�B�C,�,/C'�'C,c�f�|}t|t��sQ	t|�����}n.#ttt
f$rtd|����d�wxYw	|j|}|���std|�d|�����dS#t$rYdSwxYw)NzInvalid file object: zFile descriptor z is used by transport )
�
isinstance�intrK�AttributeError�	TypeError�
ValueErrorr&�
is_closingrDr)r'rrKr�s    r�_ensure_fd_no_transportz-BaseSelectorEventLoop._ensure_fd_no_transport�s������&�#�&�&�	K�
K��V�]�]�_�_�-�-����"�I�z�:�
K�
K�
K� �!?��!?�!?�@�@�d�J�
K����	&��(��0�I��'�'�)�)�
&�"�%�r�%�%� �%�%�&�&�&�
&�
&���	�	�	��D�D�	���s�!;�+A&�*
B"�"
B0�/B0c��|���tj|||d��}	|j�|��}|j|jc}\}}|j�||tjz||f��|�|�	��n8#t$r+|j�|tj|df��YnwxYw|Sr-)�
_check_closedr�Handler"rrX�modifyr�
EVENT_READ�cancelr�register�	r'r�callback�args�handler�mask�reader�writers	         rrSz!BaseSelectorEventLoop._add_reader	s�����������x��t�T�:�:��
	 ��.�(�(��,�,�C�
&)�Z���"�D�"�6�6��N�!�!�"�d�Y�-A�&A�#)�6�"2�
4�
4�
4��!��
�
�������	4�	4�	4��N�#�#�B�	�(<�%+�T�N�
4�
4�
4�
4�
4�	4�����
��B�2C�Cc�t�|���rdS	|j�|��}|j|jc}\}}|t
jz}|s|j�|��n|j�||d|f��|�|�	��dSdS#t$rYdSwxYw�NFT)rEr"rrrXrr��
unregisterr�r�r�r'rrr�r�r�s      rrIz$BaseSelectorEventLoop._remove_readers����>�>���	��5�	��.�(�(��,�,�C�&)�Z���"�D�"�6�6��Y�)�)�)�D��
@���)�)�"�-�-�-�-���%�%�b�$��v��?�?�?��!��
�
�����t��u���	�	�	��5�5�	���s�B)�)
B7�6B7c��|���tj|||d��}	|j�|��}|j|jc}\}}|j�||tjz||f��|�|�	��n8#t$r+|j�|tjd|f��YnwxYw|Sr-)r�rr�r"rrXr�r�EVENT_WRITEr�rr�r�s	         r�_add_writerz!BaseSelectorEventLoop._add_writer.s�����������x��t�T�:�:��
	 ��.�(�(��,�,�C�
&)�Z���"�D�"�6�6��N�!�!�"�d�Y�-B�&B�#)�6�"2�
4�
4�
4��!��
�
�������	4�	4�	4��N�#�#�B�	�(=�%)�6�N�
4�
4�
4�
4�
4�	4�����
r�c�v�	|���rdS	|j�|��}|j|jc}\}}|t
jz}|s|j�|��n|j�|||df��|�|�	��dSdS#t$rYdSwxYwr�)rEr"rrrXrr�r�r�r�rr�s      r�_remove_writerz$BaseSelectorEventLoop._remove_writer>s���'��>�>���	��5�	��.�(�(��,�,�C�&)�Z���"�D�"�6�6��Y�*�*�*�D��
@���)�)�"�-�-�-�-���%�%�b�$����?�?�?��!��
�
�����t��u���	�	�	��5�5�	���s�B*�*
B8�7B8c�P�	|�|��|j||g|�R�dSr-)r�rS�r'rr�r�s    r�
add_readerz BaseSelectorEventLoop.add_readerUs<��$��$�$�R�(�(�(�����X�-��-�-�-�-�-�-r(c�X�	|�|��|�|��Sr-)r�rI�r'rs  r�
remove_readerz#BaseSelectorEventLoop.remove_readerZ�-��'��$�$�R�(�(�(��"�"�2�&�&�&r(c�P�	|�|��|j||g|�R�dSr-)r�r�r�s    r�
add_writerz BaseSelectorEventLoop.add_writer_s<��%��$�$�R�(�(�(�����X�-��-�-�-�-�-�-r(c�X�	|�|��|�|��Sr-)r�r�r�s  r�
remove_writerz#BaseSelectorEventLoop.remove_writerdr�r(c��
K�	tj|��|jr'|���dkrt	d���	|�|��S#ttf$rYnwxYw|���}|�	��}|�
|��|�||j|||��}|�
tj|j||�����|�d{V��S�Nr�the socket must be non-blocking�r�)r�_check_ssl_socketrd�
gettimeoutr�r[r]r\r�rKr�rS�
_sock_recv�add_done_callback�	functools�partial�_sock_read_done)r'r/�n�futrr�s      r�	sock_recvzBaseSelectorEventLoop.sock_recvis����	�	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?�	��9�9�Q�<�<����!1�2�	�	�	��D�	����� � �"�"��
�[�[�]�]���$�$�R�(�(�(��!�!�"�d�o�s�D�!�D�D�������d�2�B�v�F�F�F�	H�	H�	H��y�y�y�y�y�y���A�A0�/A0c�`�|�|���s|�|��dSdSr-)�	cancelledr��r'rr�r�s    rr�z%BaseSelectorEventLoop._sock_read_done�8���>��!1�!1�!3�!3�>����r�"�"�"�"�"��>r(c�*�|���rdS	|�|��}|�|��dS#ttf$rYdSt
tf$r�t$r }|�|��Yd}~dSd}~wwxYwr-)	�doner[�
set_resultr]r\r�r�r��
set_exception)r'r�r/r�rXr�s      rr�z BaseSelectorEventLoop._sock_recv�s����8�8�:�:�	��F�		!��9�9�Q�<�<�D�
�N�N�4� � � � � �� �!1�2�	�	�	��F�F��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�"�����	#�����A�B�B�2B
�
Bc��
K�	tj|��|jr'|���dkrt	d���	|�|��S#ttf$rYnwxYw|���}|�	��}|�
|��|�||j|||��}|�
tj|j||�����|�d{V��Sr�)rr�rdr�r��	recv_intor]r\r�rKr�rS�_sock_recv_intor�r�r�r�)r'r/�bufr�rr�s      r�sock_recv_intoz$BaseSelectorEventLoop.sock_recv_into�s����	�
	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?�	��>�>�#�&�&�&���!1�2�	�	�	��D�	����� � �"�"��
�[�[�]�]���$�$�R�(�(�(��!�!�"�d�&:�C��s�K�K�������d�2�B�v�F�F�F�	H�	H�	H��y�y�y�y�y�y�r�c�*�|���rdS	|�|��}|�|��dS#ttf$rYdSt
tf$r�t$r }|�|��Yd}~dSd}~wwxYwr-)	r�r�r�r]r\r�r�r�r�)r'r�r/r��nbytesr�s      rr�z%BaseSelectorEventLoop._sock_recv_into�s����8�8�:�:�	��F�		#��^�^�C�(�(�F�
�N�N�6�"�"�"�"�"�� �!1�2�	�	�	��F�F��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�"�����	#���r�c��
K�	tj|��|jr'|���dkrt	d���	|�|��S#ttf$rYnwxYw|���}|�	��}|�
|��|�||j|||��}|�
tj|j||�����|�d{V��Sr�)rr�rdr�r��recvfromr]r\r�rKr�rS�_sock_recvfromr�r�r�r�)r'r/�bufsizer�rr�s      r�
sock_recvfromz#BaseSelectorEventLoop.sock_recvfrom�s����	�	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?�	��=�=��)�)�)���!1�2�	�	�	��D�	����� � �"�"��
�[�[�]�]���$�$�R�(�(�(��!�!�"�d�&9�3��g�N�N�������d�2�B�v�F�F�F�	H�	H�	H��y�y�y�y�y�y�r�c�*�|���rdS	|�|��}|�|��dS#ttf$rYdSt
tf$r�t$r }|�|��Yd}~dSd}~wwxYwr-)	r�r�r�r]r\r�r�r�r�)r'r�r/r��resultr�s      rr�z$BaseSelectorEventLoop._sock_recvfrom�s����8�8�:�:�	��F�		#��]�]�7�+�+�F�
�N�N�6�"�"�"�"�"�� �!1�2�	�	�	��F�F��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�"�����	#���r�rc��0K�	tj|��|jr'|���dkrt	d���|st|��}	|�||��S#ttf$rYnwxYw|�	��}|�
��}|�|��|�||j
||||��}|�tj|j||�����|�d{V��Sr�)rr�rdr�r��len�
recvfrom_intor]r\r�rKr�rS�_sock_recvfrom_intor�r�r�r�)r'r/r�r�r�rr�s       r�sock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_into�s<����	�
	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?��	���X�X�F�	��%�%�c�6�2�2�2���!1�2�	�	�	��D�	����� � �"�"��
�[�[�]�]���$�$�R�(�(�(��!�!�"�d�&>��T�3�"(�*�*�������d�2�B�v�F�F�F�	H�	H�	H��y�y�y�y�y�y�s�A.�.B�Bc�,�|���rdS	|�||��}|�|��dS#ttf$rYdSt
tf$r�t$r }|�|��Yd}~dSd}~wwxYwr-)	r�r�r�r]r\r�r�r�r�)r'r�r/r�r�r�r�s       rr�z)BaseSelectorEventLoop._sock_recvfrom_into�s����8�8�:�:�	��F�		#��'�'��W�5�5�F�
�N�N�6�"�"�"�"�"�� �!1�2�	�	�	��F�F��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�"�����	#���s�A�B�B�3B�Bc	��XK�	tj|��|jr'|���dkrt	d���	|�|��}n#ttf$rd}YnwxYw|t|��krdS|�	��}|�
��}|�|��|�||j
||t|��|g��}|�t!j|j||�����|�d{V��Sr�)rr�rdr�r�rbr]r\r�r�rKr�r��
_sock_sendall�
memoryviewr�r�r��_sock_write_done)r'r/rXr�r�rr�s       r�sock_sendallz"BaseSelectorEventLoop.sock_sendallsH����	�	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?�	��	�	�$���A�A���!1�2�	�	�	��A�A�A�	����
��D�	�	�>�>��F�� � �"�"��
�[�[�]�]���$�$�R�(�(�(��!�!�"�d�&8�#�t�",�T�"2�"2�Q�C�9�9�������d�3�R��G�G�G�	I�	I�	I��y�y�y�y�y�y�s�A�A3�2A3c��|���rdS|d}	|�||d���}nQ#ttf$rYdStt
f$r�t$r }|�|��Yd}~dSd}~wwxYw||z
}|t|��kr|�	d��dS||d<dS�Nr)
r�rbr]r\r�r�r�r�r�r�)r'r�r/�view�pos�startr�r�s        rr�z#BaseSelectorEventLoop._sock_sendall*s����8�8�:�:�	��F��A���	��	�	�$�u�v�v�,�'�'�A�A���!1�2�	�	�	��F�F��-�.�	�	�	���	�	�	����c�"�"�"��F�F�F�F�F�����	����	��
���C��I�I����N�N�4� � � � � ��C��F�F�Fs�>�B�B�,B�Bc��K�	tj|��|jr'|���dkrt	d���	|�||��S#ttf$rYnwxYw|���}|�	��}|�
|��|�||j||||��}|�
tj|j||�����|�d{V��Sr�)rr�rdr�r��sendtor]r\r�rKr�r��_sock_sendtor�r�r�r�)r'r/rXr@r�rr�s       r�sock_sendtoz!BaseSelectorEventLoop.sock_sendto@s)����	�	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?�	��;�;�t�W�-�-�-���!1�2�	�	�	��D�	����� � �"�"��
�[�[�]�]���$�$�R�(�(�(��!�!�"�d�&7��d�D�")�+�+�������d�3�R��G�G�G�	I�	I�	I��y�y�y�y�y�y�s�A�A1�0A1c�.�|���rdS	|�|d|��}|�|��dS#ttf$rYdSt
tf$r�t$r }|�|��Yd}~dSd}~wwxYwr�)	r�r�r�r]r\r�r�r�r�)r'r�r/rXr@r�r�s       rr�z"BaseSelectorEventLoop._sock_sendto[s����8�8�:�:�	��F�		����D�!�W�-�-�A�
�N�N�1������� �!1�2�	�	�	��F�F��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�"�����	#���s�A�B�B�4B�Bc���K�	tj|��|jr'|���dkrt	d���|jtjks!tjrR|jtj	kr=|�
||j|j|j|����d{V��}|d\}}}}}|�
��}|�|||��	|�d{V��	d}S#d}wxYw)Nrr�)�family�type�proto�loop)rr�rdr�r�r�rP�AF_INET�	_HAS_IPv6�AF_INET6�_ensure_resolvedr�r�r��
_sock_connect)r'r/r@�resolvedrr�s      r�sock_connectz"BaseSelectorEventLoop.sock_connectjs+����	�	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?��;�&�.�(�(��%�)�*.�+���*H�*H�!�2�2����$�)�4�:��3���������H�#+�1�+��A�q�!�Q��� � �"�"�����3��g�.�.�.�	��9�9�9�9�9�9���C�C��$�C�J�J�J�Js�%C0�0C4c��|���}	|�|��|�d��n�#ttf$re|�|��|�||j|||��}|�tj
|j||�����Yn<ttf$r�t$r}|�|��Yd}~nd}~wwxYwd}dS#d}wxYw)Nr�)rK�connectr�r]r\r�r��_sock_connect_cbr�r�r�r�r�r�r�r�)r'r�r/r@rr�r�s       rr�z#BaseSelectorEventLoop._sock_connect�sG��
�[�[�]�]��	��L�L��!�!�!� 
�N�N�4� � � � �� �!1�2�		M�		M�		M�

�(�(��,�,�,��%�%��D�)�3��g�?�?�F��!�!��!�$�"7��F�K�K�K�
M�
M�
M�
M�
M��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�����	#����
�C�C�C��$�C�J�J�J�Js;�A�C6�A3C/�4C6�6C/�C*�%C6�*C/�/C6�6C:c�`�|�|���s|�|��dSdSr-)r�r�r�s    rr�z&BaseSelectorEventLoop._sock_write_done�r�r(c��|���rdS	|�tjtj��}|dkrt|d|�����	|�d��nO#ttf$rYn<ttf$r�t$r}|�|��Yd}~nd}~wwxYwd}dS#d}wxYw)NrzConnect call failed )
r��
getsockoptrP�
SOL_SOCKET�SO_ERRORrcr�r]r\r�r�r�r�)r'r�r/r@�errr�s      rr�z&BaseSelectorEventLoop._sock_connect_cb�s���8�8�:�:�	��F�	��/�/�&�"3�V�_�E�E�C��a�x�x��c�#C�'�#C�#C�D�D�D��
�N�N�4� � � � �� �!1�2�	�	�	��D��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�����	#����
�C�C�C��$�C�J�J�J�Js<�AA2�C�2B>�C�B>�B9�4C�9B>�>C�C	c���K�	tj|��|jr'|���dkrt	d���|���}|�||��|�d{V��S)Nrr�)rr�rdr�r�r��_sock_accept)r'r/r�s   r�sock_acceptz!BaseSelectorEventLoop.sock_accept�s�����	�	�%�d�+�+�+��;�	@�4�?�?�,�,��1�1��>�?�?�?�� � �"�"�����#�t�$�$�$��y�y�y�y�y�y�r(c��|���}	|���\}}|�d��|�||f��dS#tt
f$re|�|��|�||j||��}|�	tj|j||�����YdSttf$r�t$r }|�|��Yd}~dSd}~wwxYw)NFr�)rKrrrRr�r]r\r�rSrr�r�r�r�r�r�r�r�)r'r�r/rr�r@r�r�s        rrz"BaseSelectorEventLoop._sock_accept�sI��
�[�[�]�]��
	,� �K�K�M�M�M�D�'����U�#�#�#�
�N�N�D�'�?�+�+�+�+�+�� �!1�2�	L�	L�	L��(�(��,�,�,��%�%�b�$�*;�S�$�G�G�F��!�!��!�$�"6��6�J�J�J�
L�
L�
L�
L�
L�
L��-�.�	�	�	���	#�	#�	#����c�"�"�"�"�"�"�"�"�"�����	#���s�,A�A2D
�D
�*D�D
c���K�|j|j=|���}|���|����d{V��	|�|j|||d����d{V��	|���|r|���||j|j<S#|���|r|���||j|j<wxYw)NF)�fallback)	r&�_sock_fd�
is_reading�
pause_reading�_make_empty_waiter�
sock_sendfile�_sock�_reset_empty_waiter�resume_reading)r'�transp�file�offset�countrs      r�_sendfile_nativez&BaseSelectorEventLoop._sendfile_native�s1������V�_�-��*�*�,�,���������'�'�)�)�)�)�)�)�)�)�)�	7��+�+�F�L�$���5:�,�<�<�<�<�<�<�<�<�
<�
�&�&�(�(�(��
(��%�%�'�'�'�06�D��V�_�-�-��
�&�&�(�(�(��
(��%�%�'�'�'�06�D��V�_�-�6�6�6�6s�$B2�2;C-c�F�|D]�\}}|j|jc}\}}|tjzr4|�2|jr|�|��n|�|��|tjzr4|�2|jr|�|����|�|����dSr-)	�fileobjrXrr��
_cancelledrI�
_add_callbackr�r�)r'�
event_listrr�rr�r�s       r�_process_eventsz%BaseSelectorEventLoop._process_events�s���#�	/�	/�I�C��(+��S�X�%�G�%�f�f��i�*�*�
/�v�/A��$�/��'�'��0�0�0�0��&�&�v�.�.�.��i�+�+�
/��0B��$�/��'�'��0�0�0�0��&�&�v�.�.�.��	/�	/r(c�|�|�|�����|���dSr-)rIrKrG)r'r/s  r�
_stop_servingz#BaseSelectorEventLoop._stop_serving�s/�����D�K�K�M�M�*�*�*��
�
�����r(r-�NNN)r)3r!�
__module__�__qualname__rr2r�SSL_HANDSHAKE_TIMEOUT�SSL_SHUTDOWN_TIMEOUTr=rArGrFr#rYrTrfrlrirsr�rSrIr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�
__classcell__�r s@rrr+s���������
9�9�9�9�9�9�7�%)�$�7�7�7�7�7�9=�+� �$��t�"+�"A�!*�!?�+�+�+�+�+�$CG�B�B�B�B�
	"�	"�	"�	"�	"� � � �E�E�E�
�
�
�
�
�
�,�,�,�&#'�t�S�-6�-L�,5�,J�F�F�F�F��D�#�"+�"A�!*�!?�	,)�,)�,)�,)�`�D�"+�"A�!*�!?�	-5�-5�-5�-5�^&�&�&�$��� ���*��� ���..�.�.�
'�'�'�
.�.�.�
'�'�'�
���,#�#�#�#�!�!�!� ���*#�#�#�"���.#�#�#�"����2#�#�#�"���>���,���6
�
�
����2���.#�#�#�#����*
�
�
�,�,�,�"7�7�7�/�/�/�������r(rc���eZdZdZeZdZd�fd�	Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zejfd
�Zdd�Zd�Zd�Zd�Zd�Z�xZS)�_SelectorTransportiNc���t���||��tj|��|jd<	|���|jd<n#t$r
d|jd<YnwxYwd|jvr=	|���|jd<n#tj	$r
d|jd<YnwxYw||_
|���|_d|_
|�|��||_|���|_d|_d|_d|_|j�|j���||j|j<dS)NrP�socknamernFr)rrrr|�_extra�getsocknamerc�getpeernamerP�errorrrKr�_protocol_connected�set_protocol�_server�_buffer_factory�_buffer�
_conn_lost�_closing�_paused�_attachr&)r'r�r/r0r*r+r s      �rrz_SelectorTransport.__init__so���
�������%�%�%� &� 6�t� <� <���H��	+�&*�&6�&6�&8�&8�D�K�
�#�#���	+�	+�	+�&*�D�K�
�#�#�#�	+�����T�[�(�(�
/�*.�*:�*:�*<�*<���J�'�'���<�
/�
/�
/�*.���J�'�'�'�
/������
����
�
��
�#(�� ����(�#�#�#�����+�+�-�-��������
�����<�#��L� � �"�"�"�*.�����'�'�'s$�A�A5�4A5�B�B;�:B;c���|jjg}|j�|�d��n|jr|�d��|�d|j����|j��|j���s�t|jj	|jtj��}|r|�d��n|�d��t|jj	|jtj��}|rd}nd}|�
��}|�d|�d	|�d
���d�d�|����S)
N�closed�closingzfd=zread=pollingz	read=idle�polling�idlezwrite=<z
, bufsize=�>z<{}>� )r r!r�appendr5r�_looprErr"rr�r��get_write_buffer_size�format�join)r'�infor;�stater�s     r�__repr__z_SelectorTransport.__repr__s]����'�(���:���K�K��!�!�!�!�
�]�	#��K�K�	�"�"�"����)�$�-�)�)�*�*�*��:�!�$�*�*>�*>�*@�*@�!�*�4�:�+?�+/�=�)�:N�P�P�G��
)����N�+�+�+�+����K�(�(�(�*�4�:�+?�+/�=�+4�+@�B�B�G��
�!������0�0�2�2�G��K�K�=�%�=�=�7�=�=�=�>�>�>��}�}�S�X�X�d�^�^�,�,�,r(c�0�|�d��dSr-)�_force_closerNs r�abortz_SelectorTransport.abort8s�����$�����r(c�"�||_d|_dS�NT)�	_protocolr/)r'r0s  rr0z_SelectorTransport.set_protocol;s��!���#'�� � � r(c��|jSr-)rLrNs r�get_protocolz_SelectorTransport.get_protocol?s
���~�r(c��|jSr-)r5rNs rr�z_SelectorTransport.is_closingBs
���}�r(c�<�|���o|jSr-)r�r6rNs rrz_SelectorTransport.is_readingEs���?�?�$�$�$�9�T�\�)9�9r(c���|���sdSd|_|j�|j��|j���rt
jd|��dSdS)NTz%r pauses reading)rr6r@rIr�	get_debugr
rrNs rr
z _SelectorTransport.pause_readingHsq����� � �	��F�����
�!�!�$�-�0�0�0��:���!�!�	4��L�,�d�3�3�3�3�3�	4�	4r(c���|js|jsdSd|_|�|j|j��|j���rtjd|��dSdS)NFz%r resumes reading)	r5r6rSr�_read_readyr@rRr
rrNs rrz!_SelectorTransport.resume_readingPsu���=�	���	��F����������(8�9�9�9��:���!�!�	5��L�-�t�4�4�4�4�4�	5�	5r(c��|jrdSd|_|j�|j��|jsQ|xjdz
c_|j�|j��|j�|jd��dSdS�NTr)	r5r@rIrr3r4r��	call_soon�_call_connection_lostrNs rrGz_SelectorTransport.closeXs����=�	��F���
��
�!�!�$�-�0�0�0��|�	C��O�O�q� �O�O��J�%�%�d�m�4�4�4��J� � ��!;�T�B�B�B�B�B�	C�	Cr(c�v�|j�1|d|��t|���|j���dSdS)Nzunclosed transport )�source)r�ResourceWarningrG)r'�_warns  r�__del__z_SelectorTransport.__del__bsL���:�!��E�0��0�0�/�$�O�O�O�O��J��������"�!r(�Fatal error on transportc��t|t��r2|j���rt	jd||d���n$|j�||||jd���|�|��dS)Nz%r: %sTr`)rorpr�r0)	r�rcr@rRr
rr{rLrH)r'r�ros   r�_fatal_errorz_SelectorTransport._fatal_errorgs����c�7�#�#�		��z�#�#�%�%�
E���X�t�W�t�D�D�D�D���J�-�-�"� �!� �N�	/�/�
�
�
�	
���#�����r(c�P�|jrdS|jr8|j���|j�|j��|js&d|_|j�|j��|xjdz
c_|j�|j	|��dSrV)
r4r3�clearr@r�rr5rIrWrX)r'r�s  rrHz_SelectorTransport._force_closeus����?�	��F��<�	5��L��� � � ��J�%�%�d�m�4�4�4��}�	5� �D�M��J�%�%�d�m�4�4�4����1�����
���T�7��=�=�=�=�=r(c��	|jr|j�|��|j���d|_d|_d|_|j}|�|���d|_dSdS#|j���d|_d|_d|_|j}|�|���d|_wxYwr-)r/rL�connection_lostrrGr@r1�_detach)r'r�r+s   rrXz(_SelectorTransport._call_connection_lost�s���	$��'�
4���.�.�s�3�3�3��J�������D�J�!�D�N��D�J��\�F��!���� � � �#�����"�!��
�J�������D�J�!�D�N��D�J��\�F��!���� � � �#���#�#�#�#s�!A9�9AC
c�*�t|j��Sr-)r�r3rNs rrAz(_SelectorTransport.get_write_buffer_size�s���4�<� � � r(c�Z�|���sdS|jj||g|�R�dSr-)rr@rSr�s    rrSz_SelectorTransport._add_reader�s>����� � �	��F���
��r�8�3�d�3�3�3�3�3�3r()NN)r^)r!r!r"�max_size�	bytearrayr2rrrFrIr0rNr�rr
rrG�warnings�warnr]r`rHrXrArSr%r&s@rr(r(�sE��������H��O�

�E�/�/�/�/�/�/�8-�-�-�8 � � �(�(�(�������:�:�:�4�4�4�5�5�5�C�C�C�%�M�����
����
>�
>�
>�$�$�$�!�!�!�4�4�4�4�4�4�4r(r(c���eZdZdZejjZ		d�fd�	Z�fd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Z�fd
�Zd�Zd�Z�xZS)r.TNc���d|_t���|||||��d|_d|_tj|j��|j�	|j
j|��|j�	|j|j
|j��|�(|j�	tj|d��dSdSr)�_read_ready_cbrr�_eof�
_empty_waiterr�_set_nodelayrr@rWrL�connection_maderSrrTr�_set_result_unless_cancelled)r'r�r/r0r1r*r+r s       �rrz!_SelectorSocketTransport.__init__�s����#���
������t�X�u�f�=�=�=���	�!���
	� ���,�,�,��
���T�^�;�T�B�B�B��
���T�-�!�]�D�,<�	>�	>�	>����J� � ��!E�!'��
/�
/�
/�
/�
/��r(c���t|tj��r
|j|_n|j|_t
���|��dSr-)r�r	�BufferedProtocol�_read_ready__get_bufferrn�_read_ready__data_receivedrr0)r'r0r s  �rr0z%_SelectorSocketTransport.set_protocol�sP����h�	� :�;�;�	B�"&�">�D���"&�"A�D��
�����X�&�&�&�&�&r(c�.�|���dSr-)rnrNs rrTz$_SelectorSocketTransport._read_ready�s���������r(c���|jrdS	|j�d��}t|��st	d���n?#t
tf$r�t$r!}|�|d��Yd}~dSd}~wwxYw	|j	�
|��}nR#ttf$rYdSt
tf$r�t$r!}|�|d��Yd}~dSd}~wwxYw|s|�
��dS	|j�|��dS#t
tf$r�t$r!}|�|d��Yd}~dSd}~wwxYw)N���z%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.�$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)r4rL�
get_bufferr�rDr�r�r�r`rr�r]r\�_read_ready__on_eof�buffer_updated)r'r�r�r�s    rrvz0_SelectorSocketTransport._read_ready__get_buffer�s���?�	��F�		��.�+�+�B�/�/�C��s�8�8�
L�"�#J�K�K�K�
L���-�.�	�	�	���	�	�	�����F�
H�
H�
H��F�F�F�F�F�����	����
	��Z�)�)�#�.�.�F�F���!1�2�	�	�	��F�F��-�.�	�	�	���	�	�	����c�#I�J�J�J��F�F�F�F�F�����	�����	��$�$�&�&�&��F�	L��N�)�)�&�1�1�1�1�1���-�.�	�	�	���	L�	L�	L�����J�
L�
L�
L�
L�
L�
L�
L�
L�
L�����	L���sM�8A�B�A;�;B�B�C.�3C.�
C)�)C.�
D&�&E"�E�E"c���|jrdS	|j�|j��}nR#tt
f$rYdSttf$r�t$r!}|�	|d��Yd}~dSd}~wwxYw|s|�
��dS	|j�|��dS#ttf$r�t$r!}|�	|d��Yd}~dSd}~wwxYw)Nr{z2Fatal error: protocol.data_received() call failed.)
r4rr[rhr]r\r�r�r�r`r}rL�
data_received)r'rXr�s   rrwz3_SelectorSocketTransport._read_ready__data_received�sp���?�	��F�	��:�?�?�4�=�1�1�D�D���!1�2�	�	�	��F�F��-�.�	�	�	���	�	�	����c�#I�J�J�J��F�F�F�F�F�����	�����	��$�$�&�&�&��F�	K��N�(�(��.�.�.�.�.���-�.�	�	�	���	K�	K�	K�����I�
K�
K�
K�
K�
K�
K�
K�
K�
K�����	K���s2�+�A:�A:�A5�5A:�B2�2C.�
C)�)C.c��|j���rtjd|��	|j���}n?#ttf$r�t$r!}|�	|d��Yd}~dSd}~wwxYw|r!|j�
|j��dS|���dS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.)
r@rRr
rrL�eof_receivedr�r�r�r`rIrrG)r'�	keep_openr�s   rr}z,_SelectorSocketTransport._read_ready__on_eof�s����:���!�!�	2��L�*�D�1�1�1�	���3�3�5�5�I�I���-�.�	�	�	���	�	�	�����H�
J�
J�
J��F�F�F�F�F�����	����
�	�
�J�%�%�d�m�4�4�4�4�4��J�J�L�L�L�L�Ls�A
�
B�%B�Bc� �t|tttf��s$t	dt|��j�����|jrtd���|j	�td���|sdS|j
r;|j
tjkrtjd��|xj
dz
c_
dS|js�	|j�|��}||d�}|sdSnQ#t$t&f$rYn>t(t*f$r�t,$r!}|�|d��Yd}~dSd}~wwxYw|j�|j|j��|j�|��|���dS)N�/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progress�socket.send() raised exception.r�%Fatal write error on socket transport)r��bytesrir�r�r�r!rorDrpr4r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr
�warningr3rrbr]r\r�r�r�r`r@r�r�_write_ready�extend�_maybe_pause_protocol)r'rXr�r�s    r�writez_SelectorSocketTransport.writes����$��	�:� >�?�?�	<��;�#'��:�:�#6�;�;�<�<�
<��9�	H��F�G�G�G���)��I�J�J�J��	��F��?�	���)�"M�M�M���@�A�A�A��O�O�q� �O�O��F��|�	E�
��J�O�O�D�)�)���A�B�B�x�����F���$�%5�6�
�
�
���� 1�2�
�
�
�� �
�
�
��!�!�#�'N�O�O�O�����������
����
�J�"�"�4�=�$�2C�D�D�D�	
����D�!�!�!��"�"�$�$�$�$�$s�C*�*D8�=D8�D3�3D8c�"�|jrdS	|j�|j��}|r
|jd|�=|���|js�|j�|j��|j�|j�	d��|j
r|�d��dS|jr(|j�
tj��dSdSdS#t t"f$rYdSt$t&f$r�t($r�}|j�|j��|j���|�|d��|j� |j�|��Yd}~dSYd}~dSd}~wwxYw)Nr�)r4rrbr3�_maybe_resume_protocolr@r�rrpr�r5rXro�shutdownrP�SHUT_WRr]r\r�r�r�rbr`r�)r'r�r�s   rr�z%_SelectorSocketTransport._write_ready8s����?�	��F�	8��
�����-�-�A��
%��L��!��$��'�'�)�)�)��<�
8��
�)�)�$�-�8�8�8��%�1��&�1�1�$�7�7�7��=�8��.�.�t�4�4�4�4�4��Y�8��J�'�'���7�7�7�7�7�
8�
8�8�8��) �!1�2�	�	�	��D�D��-�.�	�	�	���	6�	6�	6��J�%�%�d�m�4�4�4��L��� � � ����c�#J�K�K�K��!�-��"�0�0��5�5�5�5�5�5�5�5�5�.�-�-�-�-�-�����		6���s�C � F�4F�A/F	�	Fc��|js|jrdSd|_|js&|j�t
j��dSdSrK)r5ror3rr�rPr�rNs r�	write_eofz"_SelectorSocketTransport.write_eofVsS���=�	�D�I�	��F���	��|�	0��J�����/�/�/�/�/�	0�	0r(c��dSrKrVrNs r�
can_write_eofz&_SelectorSocketTransport.can_write_eof]s���tr(c���t���|��|j�)|j�t	d����dSdS)NzConnection is closed by peer)rrXrpr��ConnectionError)r'r�r s  �rrXz._SelectorSocketTransport._call_connection_lost`sb���
���%�%�c�*�*�*���)���,�,�� >�?�?�
A�
A�
A�
A�
A�*�)r(c��|j�td���|j���|_|js|j�d��|jS)NzEmpty waiter is already set)rprDr@r�r3r�rNs rrz+_SelectorSocketTransport._make_empty_waiterfsZ����)��<�=�=�=�!�Z�5�5�7�7����|�	0���)�)�$�/�/�/��!�!r(c��d|_dSr-)rprNs rrz,_SelectorSocketTransport._reset_empty_waiterns��!����r(r )r!r!r"�_start_tls_compatibler�
_SendfileMode�
TRY_NATIVE�_sendfile_compatiblerr0rTrvrwr}r�r�r�r�rXrrr%r&s@rr.r.�s*������� ��$�2�=��48�$(�/�/�/�/�/�/�,'�'�'�'�'����#L�#L�#L�JK�K�K�2���*%%�%%�%%�N8�8�8�<0�0�0����A�A�A�A�A�"�"�"�"�"�"�"�"�"�"r(r.c�L��eZdZejZ		d�fd�	Zd�Zd�Zdd�Z	d�Z
�xZS)	r?Nc�`��t���||||��||_d|_|j�|jj|��|j�|j|j	|j
��|�(|j�tj|d��dSdSr�)
rr�_address�_buffer_sizer@rWrLrrrSrrTrrs)r'r�r/r0r@r1r*r s       �rrz#_SelectorDatagramTransport.__init__vs����
������t�X�u�5�5�5���
�����
���T�^�;�T�B�B�B��
���T�-�!�]�D�,<�	>�	>�	>����J� � ��!E�!'��
/�
/�
/�
/�
/��r(c��|jSr-)r�rNs rrAz0_SelectorDatagramTransport.get_write_buffer_size�s��� � r(c��|jrdS	|j�|j��\}}|j�||��dS#ttf$rYdSt$r%}|j�	|��Yd}~dSd}~wttf$r�t$r!}|�
|d��Yd}~dSd}~wwxYw)Nz&Fatal read error on datagram transport)r4rr�rhrL�datagram_receivedr]r\rc�error_receivedr�r�r�r`�r'rXr�r�s    rrTz&_SelectorDatagramTransport._read_ready�s���?�	��F�	9���,�,�T�]�;�;�J�D�$�
�N�,�,�T�4�8�8�8�8�8�� �!1�2�	�	�	��D�D��	/�	/�	/��N�)�)�#�.�.�.�.�.�.�.�.�.������-�.�	�	�	���	M�	M�	M����c�#K�L�L�L�L�L�L�L�L�L�����	M���s)�"A
�
C�	C�'B�C�%C�Cc� �t|tttf��s$t	dt|��j�����|sdS|jr)|d|jfvrtd|j�����|j}|j	rB|jr;|j	tjkrtj
d��|xj	dz
c_	dS|js�	|jdr|j�|��n|j�||��dS#t&t(f$r(|j�|j|j��Ynkt2$r%}|j�|��Yd}~dSd}~wt8t:f$r�t<$r!}|�|d��Yd}~dSd}~wwxYw|j� t|��|f��|xj!tE|��z
c_!|�#��dS)Nr�z!Invalid address: must be None or r�rrn�'Fatal write error on datagram transport)$r�r�rir�r�r�r!r�r�r4rr�r
r�r3r+rrbr�r]r\r@r�r�
_sendto_readyrcrLr�r�r�r�r`r?r�r�r�r�s    rr�z!_SelectorDatagramTransport.sendto�si���$��	�:� >�?�?�	<��;�#'��:�:�#6�;�;�<�<�
<��	��F��=�	!��D�$�-�0�0�0� �G��
�G�G�I�I�I��=�D��?�	�t�}�	���)�"M�M�M���@�A�A�A��O�O�q� �O�O��F��|�	�
��;�z�*�2��J�O�O�D�)�)�)�)��J�%�%�d�D�1�1�1����#�%5�6�
J�
J�
J��
�&�&�t�}�d�6H�I�I�I�I�I��
�
�
���-�-�c�2�2�2������������ 1�2�
�
�
�� �
�
�
��!�!��B�D�D�D�����������
����	
����U�4�[�[�$�/�0�0�0����S��Y�Y�&����"�"�$�$�$�$�$s+�AD�6F1�		F1�E2�2F1�F,�,F1c�D�|j�r=|j���\}}|xjt|��zc_	|jdr|j�|��n|j�||��n�#ttf$r<|j�
||f��|xjt|��z
c_Ynst$r%}|j�
|��Yd}~dSd}~wttf$r�t $r!}|�|d��Yd}~dSd}~wwxYw|j��=|���|js=|j�|j��|jr|�d��dSdSdS)Nrnr�)r3�popleftr�r�r+rrbr�r]r\�
appendleftrcrLr�r�r�r�r`r�r@r�rr5rXr�s    rr�z(_SelectorDatagramTransport._sendto_ready�s����l�	���-�-�/�/�J�D�$�����T���*���
��;�z�*�2��J�O�O�D�)�)�)�)��J�%�%�d�D�1�1�1���#�%5�6�
�
�
���'�'��t��5�5�5��!�!�S��Y�Y�.�!�!����
�
�
���-�-�c�2�2�2������������ 1�2�
�
�
�� �
�
�
��!�!��B�D�D�D�����������
����#�l�	�,	
�#�#�%�%�%��|�	1��J�%�%�d�m�4�4�4��}�
1��*�*�4�0�0�0�0�0�	1�	1�
1�
1s,�AB�A
D;�	D;�C<�<D;�D6�6D;r r-)r!r!r"�collections�dequer2rrArTr�r�r%r&s@rr?r?rs��������!�'�O�59�$(�/�/�/�/�/�/�!�!�!�9�9�9� *%�*%�*%�*%�X1�1�1�1�1�1�1r(r?)�__all__r�rvr�rrPrjr$�ssl�ImportError�rrrrr	r
rr�logr
r�
BaseEventLoopr�_FlowControlMixin�	Transportr(r.r?rVr(r�<module>r�s%���#������������������
�
�
�
�����������J�J�J�J������
�C�C�C�����������������������������������������������������������(�(�(�F�F�F�F�F�K�5�F�F�F�Ra4�a4�a4�a4�a4��5�#�-�a4�a4�a4�HW"�W"�W"�W"�W"�1�W"�W"�W"�tl1�l1�l1�l1�l1�!3�l1�l1�l1�l1�l1s�&�0�0