%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/asyncio/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/asyncio/__pycache__/selector_events.cpython-312.pyc

�

���fq����dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
	ddlZddl
mZddl
mZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
lmZeejd�Zer	ej4d�Zd�ZGd�dej<�ZGd�dej@ejB�Z"Gd�de"�Z#Gd�de"ejH�Z%y#e$rdZY��wxYw#e$rdZY�pwxYw)z�Event loop using a selector and related classes.

A selector is a "notify-when-ready" multiplexer.  For a subclass which
also includes support for signal handling, see the unix_events sub-module.
)�BaseSelectorEventLoop�N�)�base_events)�	constants)�events)�futures)�	protocols)�sslproto)�
transports)�trsock)�logger�sendmsg�
SC_IOV_MAXFc�t�	|j|�}t|j|z�S#t$rYywxYw�NF)�get_key�boolr�KeyError)�selector�fd�event�keys    �./usr/lib/python3.12/asyncio/selector_events.py�_test_selector_eventr*sA��(����r�"���C�J�J��&�'�'������s�+�	7�7c���eZdZdZd3�fd�	Zd3ddd�d�Z	d3ddddejejd�d�Z		d4d	�Z
�fd
�Zd�Zd�Z
d
�Zd�Zd�Zdddejejfd�Zdddejejfd�Zddejejfd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd3d�Zd�Zd �Z d!�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�Z0d1�Z1d2�Z2�xZ3S)6rzJSelector event loop.

    See events.EventLoop for API specification.
    Nc���t�|��|�tj�}t	j
d|jj�||_|j�tj�|_y)NzUsing selector: %s)
�super�__init__�	selectors�DefaultSelectorr
�debug�	__class__�__name__�	_selector�_make_self_pipe�weakref�WeakValueDictionary�_transports)�selfrr"s  �rrzBaseSelectorEventLoop.__init__;sa���
������ �0�0�2�H����)�8�+=�+=�+F�+F�G�!�������"�6�6�8�����extra�serverc�D�|j|�t||||||�S�N)�_ensure_fd_no_transport�_SelectorSocketTransport)r)�sock�protocol�waiterr,r-s      r�_make_socket_transportz,BaseSelectorEventLoop._make_socket_transportEs*���$�$�T�*�'��d�H�f�(-�v�7�	7r*F)�server_side�server_hostnamer,r-�ssl_handshake_timeout�ssl_shutdown_timeoutc
��|j|�tj|||||||	|
��}t|||||��|jS)N)r8r9r+)r0r
�SSLProtocolr1�_app_transport)r)�rawsockr3�
sslcontextr4r6r7r,r-r8r9�ssl_protocols            r�_make_ssl_transportz)BaseSelectorEventLoop._make_ssl_transportKsW��	
�$�$�W�-��+�+��(�J����"7�!5�	
��	!��w��',�V�	=��*�*�*r*c�D�|j|�t||||||�Sr/)r0�_SelectorDatagramTransport)r)r2r3�addressr4r,s      r�_make_datagram_transportz.BaseSelectorEventLoop._make_datagram_transport]s,���$�$�T�*�)�$��h�*1�6�5�B�	Br*c���|j�rtd��|j�ry|j�t�|��|j�"|jj�d|_yy)Nz!Cannot close a running event loop)�
is_running�RuntimeError�	is_closed�_close_self_piper�closer$�r)r"s �rrJzBaseSelectorEventLoop.closecsa����?�?���B�C�C��>�>�������
��
���>�>�%��N�N� � �"�!�D�N�&r*c��|j|jj��|jj�d|_|jj�d|_|xj
dzc_y)Nr)�_remove_reader�_ssock�filenorJ�_csock�
_internal_fds�r)s rrIz&BaseSelectorEventLoop._close_self_pipens\�����D�K�K�.�.�0�1����������������������a��r*c�D�tj�\|_|_|jj	d�|jj	d�|xj
dz
c_|j
|jj�|j�y)NFr)	�socket�
socketpairrNrP�setblockingrQ�_add_readerrO�_read_from_selfrRs rr%z%BaseSelectorEventLoop._make_self_pipevsq��#)�#4�#4�#6� ���T�[�������&�������&����a���������+�+�-�t�/C�/C�Dr*c��yr/��r)�datas  r�_process_self_dataz(BaseSelectorEventLoop._process_self_data~s��r*c��		|jjd�}|sy|j|��1#t$rY�=t$rYywxYw)Ni)rN�recvr]�InterruptedError�BlockingIOErrorr[s  rrXz%BaseSelectorEventLoop._read_from_self�sV���
��{�{�'�'��-�����'�'��-���$�
��"�
��
�s�3�3�	A	�A	�A	c��|j}|�y	|jd�y#t$r(|jrt	j
dd��YyYywxYw)N�z3Fail to write a null byte into the self-pipe socketT��exc_info)rP�send�OSError�_debugr
r!)r)�csocks  r�_write_to_selfz$BaseSelectorEventLoop._write_to_self�sU�������=��	,��J�J�u����	,��{�{����0�&*�,��	,�s�#�,A�A�dc�f�|j|j�|j|||||||�	yr/)rWrO�_accept_connection)r)�protocol_factoryr2r>r-�backlogr8r9s        r�_start_servingz$BaseSelectorEventLoop._start_serving�s4��	
��������(?�(?�)�4��V�W�.�0D�	Fr*c
���t|�D]w}	|j�\}	}
|jrtjd||
|	�|	jd�d|
i}|j
||	|||||�}|j|��yy#tttf$rYyt$r�}
|
jtjtjtjtj fvry|j#d|
t%j&|�d��|j)|j+��|j-t.j0|j2|||||||�	n�Yd}
~
��dd}
~
wwxYw)Nz#%r got a new connection from %r: %rF�peernamez&socket.accept() out of system resource)�message�	exceptionrT)�range�acceptrhr
r!rV�_accept_connection2�create_taskrar`�ConnectionAbortedErrorrg�errno�EMFILE�ENFILE�ENOBUFS�ENOMEM�call_exception_handlerr�TransportSocketrMrO�
call_laterr�ACCEPT_RETRY_DELAYrp)r)rnr2r>r-ror8r9�_�conn�addrr,rv�excs              rrmz(BaseSelectorEventLoop._accept_connection�s]���w��#	)�A�"
)�!�[�[�]�
��d��;�;��L�L�!F�!'��t�5�� � ��'�2$�T�*���1�1�$�d�E�:�v�)�+?�A��� � ��(�G#	)��$�%5�7M�N�
���
��9�9����u�|�|�!&������!>�>�
�/�/�#K�%(�"(�"8�"8��">�1��
�'�'����
�6��O�O�I�$@�$@�$(�$7�$7�$4�d�J��$+�-B�$8�	:��
:��
�s�AB�E5�E5�&CE0�0E5c��K�d}d}		|�}|j�}
|r|j||||
d||||��	}	n|j|||
||��}		|
�d{���y7�#t$r|	j	�d}
�wxYw#t
tf$r�t$r?}|jr)d|d�}|�||d<|	�|	|d<|j|�Yd}~yYd}~yd}~wwxYw�w)NT)r4r6r,r-r8r9)r4r,r-z3Error on transport creation for incoming connection)rsrtr3�	transport)	�
create_futurer@r5�
BaseExceptionrJ�
SystemExit�KeyboardInterruptrhr)
r)rnr�r,r>r-r8r9r3r�r4r��contexts
             rrwz)BaseSelectorEventLoop._accept_connection2�s����
���	�&	5�'�)�H��'�'�)�F�� �4�4��(�J�v� $�E�&�*?�)=�	5�?�	�!�7�7��(�6��!�8�#�	�
����� �
����!����

���-�.�	���	5��{�{�N�!$���
�'�*2�G�J�'��(�+4�G�K�(��+�+�G�4�4���	5�sS�C�A
B�A �A�A �C�A � A=�=B�C�0C�
C�C�Cc�*�|}t|t�s	t|j��}	|j|}|j�std|�d|����y#ttt
f$rtd|���d�wxYw#t$rYywxYw)NzInvalid file object: zFile descriptor z is used by transport )
�
isinstance�intrO�AttributeError�	TypeError�
ValueErrorr(�
is_closingrGr)r)rrOr�s    rr0z-BaseSelectorEventLoop._ensure_fd_no_transports������&�#�&�
K��V�]�]�_�-��	&��(�(��0�I��'�'�)�"�&�r�f�,B� �m�%�&�&�*��#�I�z�:�
K� �#8���!?�@�d�J�
K��
�	��	�s�A�B�$B�	B�Bc���|j�tj|||d�}	|jj	|�}|j|j
c}\}}|jj
||tjz||f�|�|j�|S#t$r1|jj|tj|df�Y|SwxYwr/)�
_check_closedr�Handler$rr\�modifyr�
EVENT_READ�cancelr�register�	r)r�callback�args�handler�mask�reader�writers	         rrWz!BaseSelectorEventLoop._add_readers����������x��t�T�:��
	 ��.�.�(�(��,�C�
&)�Z�Z����"�D�"�6�6��N�N�!�!�"�d�Y�-A�-A�&A�#)�6�"2�
4��!��
�
���
���	4��N�N�#�#�B�	�(<�(<�%+�T�N�
4��
�	4���B%�%6C�Cc�|�|j�ry	|jj|�}|j|jc}\}}|t
jz}|s|jj|�n|jj||d|f�|�|j�yy#t$rYywxYw)NFT)rHr$rrr\rr��
unregisterr�r�r�r)rrr�r�r�s      rrMz$BaseSelectorEventLoop._remove_reader&s����>�>���	��.�.�(�(��,�C�&)�Z�Z����"�D�"�6�6��Y�)�)�)�)�D�����)�)�"�-����%�%�b�$��v��?��!��
�
������	��	���B/�/	B;�:B;c���|j�tj|||d�}	|jj	|�}|j|j
c}\}}|jj
||tjz||f�|�|j�|S#t$r1|jj|tjd|f�Y|SwxYwr/)r�rr�r$rr\r�r�EVENT_WRITEr�rr�r�s	         r�_add_writerz!BaseSelectorEventLoop._add_writer;s����������x��t�T�:��
	 ��.�.�(�(��,�C�
&)�Z�Z����"�D�"�6�6��N�N�!�!�"�d�Y�-B�-B�&B�#)�6�"2�
4��!��
�
���
���	4��N�N�#�#�B�	�(=�(=�%)�6�N�
4��
�	4�r�c�|�|j�ry	|jj|�}|j|jc}\}}|t
jz}|s|jj|�n|jj|||df�|�|j�yy#t$rYywxYw)�Remove a writer callback.FNT)rHr$rrr\rr�r�r�r�rr�s      r�_remove_writerz$BaseSelectorEventLoop._remove_writerKs����>�>���	��.�.�(�(��,�C�&)�Z�Z����"�D�"�6�6��Y�*�*�*�*�D�����)�)�"�-����%�%�b�$����?��!��
�
������	��	�r�c�N�|j|�|j||g|���y)zAdd a reader callback.N)r0rW�r)rr�r�s    r�
add_readerz BaseSelectorEventLoop.add_readerb�'���$�$�R�(������X�-��-r*c�F�|j|�|j|�S)zRemove a reader callback.)r0rM�r)rs  r�
remove_readerz#BaseSelectorEventLoop.remove_readerg�!���$�$�R�(��"�"�2�&�&r*c�N�|j|�|j||g|���y)zAdd a writer callback..N)r0r�r�s    r�
add_writerz BaseSelectorEventLoop.add_writerlr�r*c�F�|j|�|j|�S)r�)r0r�r�s  r�
remove_writerz#BaseSelectorEventLoop.remove_writerqr�r*c���K�tj|�|jr|j�dk7rt	d��	|j|�S#ttf$rYnwxYw|j�}|j�}|j|�|j||j|||�}|jtj|j ||���|�d{���7S�w)z�Receive data from the socket.

        The return value is a bytes object representing the data received.
        The maximum amount of data to be received at once is specified by
        nbytes.
        r�the socket must be non-blocking�r�N)r�_check_ssl_socketrh�
gettimeoutr�r_rar`r�rOr0rW�
_sock_recv�add_done_callback�	functools�partial�_sock_read_done)r)r2�n�futrr�s      r�	sock_recvzBaseSelectorEventLoop.sock_recvvs�����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?�	��9�9�Q�<����!1�2�	��	��� � �"��
�[�[�]���$�$�R�(��!�!�"�d�o�o�s�D�!�D��������d�2�2�B�v�F�	H��y�y���7�AC5�A�C5�A&�#C5�%A&�&B	C5�/C2�0C5c�L�|�|j�s|j|�yyr/)�	cancelledr��r)rr�r�s    rr�z%BaseSelectorEventLoop._sock_read_done��%���>��!1�!1�!3����r�"�"4r*c��|j�ry	|j|�}|j|�y#ttf$rYyt
tf$r�t$r}|j|�Yd}~yd}~wwxYwr/)	�doner_�
set_resultrar`r�r�r��
set_exception)r)r�r2r�r\r�s      rr�z BaseSelectorEventLoop._sock_recv�su���8�8�:��		!��9�9�Q�<�D�
�N�N�4� �� �!1�2�	���-�.�	���	#����c�"�"��	#���6�A9�A9�A4�4A9c���K�tj|�|jr|j�dk7rt	d��	|j|�S#ttf$rYnwxYw|j�}|j�}|j|�|j||j|||�}|jtj|j ||���|�d{���7S�w)z�Receive data from the socket.

        The received data is written into *buf* (a writable buffer).
        The return value is the number of bytes written.
        rr�r�N)rr�rhr�r��	recv_intorar`r�rOr0rW�_sock_recv_intor�r�r�r�)r)r2�bufr�rr�s      r�sock_recv_intoz$BaseSelectorEventLoop.sock_recv_into�s�����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?�	��>�>�#�&�&���!1�2�	��	��� � �"��
�[�[�]���$�$�R�(��!�!�"�d�&:�&:�C��s�K��������d�2�2�B�v�F�	H��y�y��r�c��|j�ry	|j|�}|j|�y#ttf$rYyt
tf$r�t$r}|j|�Yd}~yd}~wwxYwr/)	r�r�r�rar`r�r�r�r�)r)r�r2r��nbytesr�s      rr�z%BaseSelectorEventLoop._sock_recv_into�sv���8�8�:��		#��^�^�C�(�F�
�N�N�6�"�� �!1�2�	���-�.�	���	#����c�"�"��	#�r�c���K�tj|�|jr|j�dk7rt	d��	|j|�S#ttf$rYnwxYw|j�}|j�}|j|�|j||j|||�}|jtj|j ||���|�d{���7S�w)aReceive a datagram from a datagram socket.

        The return value is a tuple of (bytes, address) representing the
        datagram received and the address it came from.
        The maximum amount of data to be received at once is specified by
        nbytes.
        rr�r�N)rr�rhr�r��recvfromrar`r�rOr0rW�_sock_recvfromr�r�r�r�)r)r2�bufsizer�rr�s      r�
sock_recvfromz#BaseSelectorEventLoop.sock_recvfrom�s�����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?�	��=�=��)�)���!1�2�	��	��� � �"��
�[�[�]���$�$�R�(��!�!�"�d�&9�&9�3��g�N��������d�2�2�B�v�F�	H��y�y��r�c��|j�ry	|j|�}|j|�y#ttf$rYyt
tf$r�t$r}|j|�Yd}~yd}~wwxYwr/)	r�r�r�rar`r�r�r�r�)r)r�r2r��resultr�s      rr�z$BaseSelectorEventLoop._sock_recvfrom�sv���8�8�:��		#��]�]�7�+�F�
�N�N�6�"�� �!1�2�	���-�.�	���	#����c�"�"��	#�r�c��K�tj|�|jr|j�dk7rt	d��|st|�}	|j
||�S#ttf$rYnwxYw|j�}|j�}|j|�|j||j||||�}|jtj |j"||���|�d{���7S�w)z�Receive data from the socket.

        The received data is written into *buf* (a writable buffer).
        The return value is a tuple of (number of bytes written, address).
        rr�r�N)rr�rhr�r��len�
recvfrom_intorar`r�rOr0rW�_sock_recvfrom_intor�r�r�r�)r)r2r�r�r�rr�s       r�sock_recvfrom_intoz(BaseSelectorEventLoop.sock_recvfrom_into�s�����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?����X�F�	��%�%�c�6�2�2���!1�2�	��	��� � �"��
�[�[�]���$�$�R�(��!�!�"�d�&>�&>��T�3�"(�*��������d�2�2�B�v�F�	H��y�y��s7�A
D�A"�!D�"A4�1D�3A4�4B
D�>D�?Dc��|j�ry	|j||�}|j|�y#ttf$rYyt
tf$r�t$r}|j|�Yd}~yd}~wwxYwr/)	r�r�r�rar`r�r�r�r�)r)r�r2r�r�r�r�s       rr�z)BaseSelectorEventLoop._sock_recvfrom_intosz���8�8�:��		#��'�'��W�5�F�
�N�N�6�"�� �!1�2�	���-�.�	���	#����c�"�"��	#�s�7�A:�A:�A5�5A:c	��(K�tj|�|jr|j�dk7rt	d��	|j|�}|t|�k(ry|j�}|j�}|j|�|j||j||t|�|g�}|jt!j"|j$||���|�d{���S#ttf$rd}Y��wxYw7��w)�Send data to the socket.

        The socket must be connected to a remote socket. This method continues
        to send data from data until either all data has been sent or an
        error occurs. None is returned on success. On error, an exception is
        raised, and there is no way to determine how much data, if any, was
        successfully processed by the receiving end of the connection.
        rr�Nr�)rr�rhr�r�rfrar`r�r�rOr0r��
_sock_sendall�
memoryviewr�r�r��_sock_write_done)r)r2r\r�r�rr�s       r�sock_sendallz"BaseSelectorEventLoop.sock_sendalls�����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?�	��	�	�$��A�
��D�	�>��� � �"��
�[�[�]���$�$�R�(��!�!�"�d�&8�&8�#�t�",�T�"2�Q�C�9��������d�3�3�R��G�	I��y��� �!1�2�	��A�	���s7�AD�C9�B D�4D�5D�9D
�
D�D
�
Dc�:�|j�ry|d}	|j||d�}||z
}|t|�k(r|jd�y||d<y#ttf$rYytt
f$r�t$r}|j|�Yd}~yd}~wwxYw�Nr)
r�rfrar`r�r�r�r�r�r�)r)r�r2�view�pos�startr�r�s        rr�z#BaseSelectorEventLoop._sock_sendall7s����8�8�:���A���	��	�	�$�u�v�,�'�A�	��
���C��I���N�N�4� ��C��F�� �!1�2�	���-�.�	���	����c�"���	�s�A�B�(B�?B�Bc���K�tj|�|jr|j�dk7rt	d��	|j||�S#ttf$rYnwxYw|j�}|j�}|j|�|j||j||||�}|jtj|j ||���|�d{���7S�w)r�rr�r�N)rr�rhr�r��sendtorar`r�rOr0r��_sock_sendtor�r�r�r�)r)r2r\rCr�rr�s       r�sock_sendtoz!BaseSelectorEventLoop.sock_sendtoMs�����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?�	��;�;�t�W�-�-���!1�2�	��	��� � �"��
�[�[�]���$�$�R�(��!�!�"�d�&7�&7��d�D�")�+��������d�3�3�R��G�	I��y�y��s7�AC7�A�C7�A'�$C7�&A'�'B
C7�1C4�2C7c��|j�ry	|j|d|�}|j|�y#ttf$rYyt
tf$r�t$r}|j|�Yd}~yd}~wwxYwr�)	r�r�r�rar`r�r�r�r�)r)r�r2r\rCr�r�s       rr�z"BaseSelectorEventLoop._sock_sendtohsx���8�8�:��		����D�!�W�-�A�
�N�N�1��� �!1�2�	���-�.�	���	#����c�"�"��	#�s�8�A;�	A;� A6�6A;c�� K�tj|�|jr|j�dk7rt	d��|j
tjk(s-tjrd|j
tjk(rG|j||j
|j|j|���d{���}|d\}}}}}|j�}|j|||�	|�d{���d}S7�?7�#d}wxYw�w)zTConnect to a remote socket at address.

        This method is a coroutine.
        rr�)�family�type�proto�loopN)rr�rhr�r�r�rT�AF_INET�	_HAS_IPv6�AF_INET6�_ensure_resolvedr�r�r��
_sock_connect)r)r2rC�resolvedr�r�s      r�sock_connectz"BaseSelectorEventLoop.sock_connectws�����
	�%�%�d�+��;�;�4�?�?�,��1��>�?�?��;�;�&�.�.�(��%�%�$�+�+����*H�!�2�2�����$�)�)�4�:�:��3���H�#+�1�+��A�q�!�Q��� � �"�����3��g�.�	��9��C������C�s<�CD�D�2D�7D�<D�=D�D�D�D�Dc���|j�}	|j|�|jd�d}y#ttf$rf|j|�|j
||j|||�}|jtj|j||���Yd}yttf$r�t$r}|j|�Yd}~d}yd}~wwxYw#d}wxYw)Nr�)rO�connectr�rar`r0r��_sock_connect_cbr�r�r�r�r�r�r�r�)r)r�r2rCrr�r�s       rr�z#BaseSelectorEventLoop._sock_connect�s���
�[�[�]��	��L�L��!� 
�N�N�4� ��C��# �!1�2�		M�

�(�(��,��%�%��D�)�)�3��g�?�F��!�!��!�!�$�"7�"7��F�K�
M��C��-�.�	���	#����c�"�"��C��	#��
�C�s9�7�C"�A0C�'C"�+C�C�C"�C�C"�"C&c�L�|�|j�s|j|�yyr/)r�r�r�s    rr�z&BaseSelectorEventLoop._sock_write_done�r�r*c�v�|j�ry	|jtjtj�}|dk7rt|d|����	|j
d�d}y#ttf$rYd}yttf$r�t$r}|j|�Yd}~d}yd}~wwxYw#d}wxYw)NrzConnect call failed )
r��
getsockoptrT�
SOL_SOCKET�SO_ERRORrgr�rar`r�r�r�r�)r)r�r2rC�errr�s      rrz&BaseSelectorEventLoop._sock_connect_cb�s����8�8�:��	��/�/�&�"3�"3�V�_�_�E�C��a�x��c�%9�'��#C�D�D��
�N�N�4� ��C�� �!1�2�	���C��-�.�	���	#����c�"�"��C��	#��
�C�s<�AA*�B4�*B1�9B4�=B1�B,�%B4�,B1�1B4�4B8c���K�tj|�|jr|j�dk7rt	d��|j�}|j
||�|�d{���S7��w)aWAccept a connection.

        The socket must be bound to an address and listening for connections.
        The return value is a pair (conn, address) where conn is a new socket
        object usable to send and receive data on the connection, and address
        is the address bound to the socket on the other end of the connection.
        rr�N)rr�rhr�r�r��_sock_accept)r)r2r�s   r�sock_acceptz!BaseSelectorEventLoop.sock_accept�s_����	�%�%�d�+��;�;�4�?�?�,��1��>�?�?�� � �"�����#�t�$��y��y�s�A'A0�)A.�*A0c���|j�}	|j�\}}|jd�|j||f�y#tt
f$rc|j
|�|j||j||�}|jtj|j||���Yyttf$r�t$r}|j!|�Yd}~yd}~wwxYw)NFr�)rOrvrVr�rar`r0rWrr�r�r�r�r�r�r�r�)r)r�r2rr�rCr�r�s        rrz"BaseSelectorEventLoop._sock_accept�s���
�[�[�]��
	,� �K�K�M�M�D�'����U�#�
�N�N�D�'�?�+�� �!1�2�	L��(�(��,��%�%�b�$�*;�*;�S�$�G�F��!�!��!�!�$�"6�"6��6�J�
L��-�.�	���	#����c�"�"��	#�s�$A
�
A/C-�;C-�C(�(C-c��K�|j|j=|j�}|j�|j	��d{���	|j|j|||d���d{���|j�|r|j�||j|j<S7�h7�A#|j�|r|j�||j|j<wxYw�w)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�s��������V�_�_�-��*�*�,�������'�'�)�)�)�	7��+�+�F�L�L�$���5:�,�<�<�
�&�&�(���%�%�'�06�D���V�_�_�-�	*��<��
�&�&�(���%�%�'�06�D���V�_�_�-�s<�AC:�
B6�C:�#B:�6B8�7B:�:=C:�8B:�:=C7�7C:c�d�|D]�\}}|j|jc}\}}|tjzr1|�/|jr|j|�n|j
|�|tjzs�z|��}|jr|j|���|j
|���yr/)	�fileobjr\rr��
_cancelledrM�
_add_callbackr�r�)r)�
event_listrr�rr�r�s       r�_process_eventsz%BaseSelectorEventLoop._process_events�s���#�	/�I�C��(+���S�X�X�%�G�%�f�f��i�*�*�*�v�/A��$�$��'�'��0��&�&�v�.��i�+�+�+��0B��$�$��'�'��0��&�&�v�.�	/r*c�b�|j|j��|j�yr/)rMrOrJ)r)r2s  r�
_stop_servingz#BaseSelectorEventLoop._stop_serving�s�����D�K�K�M�*��
�
�r*r/�NNN)r)4r#�
__module__�__qualname__�__doc__rr5r�SSL_HANDSHAKE_TIMEOUT�SSL_SHUTDOWN_TIMEOUTr@rDrJrIr%r]rXrjrprmrwr0rWrMr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�rrrrr"r$�
__classcell__�r"s@rrr5so����
9�7�%)�$�7�9=�+� �$��t�"+�"A�"A�!*�!?�!?�+�&CG�B�	"� �E�
�
�,�&#'�t�S�-6�-L�-L�,5�,J�,J�F��D�#�"+�"A�"A�!*�!?�!?�	,)�`�D�"+�"A�"A�!*�!?�!?�	-5�^&�$� �*� �..�
'�
.�
'�
�,#�!� �*#�"�.#�"�2#�"�>�,�6
��2�.#��*
�,�"7�/�r*rc���eZdZdZdZd�fd�	Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zej fd
�Zdd�Zd�Zd�Zd�Zd�Z�xZS)�_SelectorTransportiNc����t�|�||�tj|�|jd<	|j�|jd<d|jvr	|j�|jd<||_
|j�|_d|_
|j|�||_t!j"�|_d|_d|_d|_|j�|jj-�||j.|j<y#t$rd|jd<Y��wxYw#tj$rd|jd<Y��wxYw)NrT�socknamerrFr)rrrr��_extra�getsocknamerg�getpeernamerT�errorrrOr�_protocol_connected�set_protocol�_server�collections�deque�_buffer�
_conn_lost�_closing�_paused�_attachr()r)r�r2r3r,r-r"s      �rrz_SelectorTransport.__init__s8���
�����%� &� 6� 6�t� <����H��	+�&*�&6�&6�&8�D�K�K�
�#��T�[�[�(�
/�*.�*:�*:�*<����J�'���
����
��
�#(�� ����(�#����"�(�(�*��������
�����<�<�#��L�L� � �"�*.�������'��+�	+�&*�D�K�K�
�#�	+��
�<�<�
/�*.����J�'�
/�s#�D'�!E�'E�E�"E*�)E*c��|jjg}|j�|jd�n|jr|jd�|jd|j
���|j��|jj�s�t|jj|j
tj�}|r|jd�n|jd�t|jj|j
tj�}|rd}nd}|j�}|jd|�d	|�d
��djdj|��S)
N�closed�closingzfd=zread=pollingz	read=idle�polling�idlezwrite=<z
, bufsize=�>z<{}>� )r"r#r�appendr<r�_looprHrr$rr�r��get_write_buffer_size�format�join)r)�inforB�stater�s     r�__repr__z_SelectorTransport.__repr__'s$�����'�'�(���:�:���K�K��!�
�]�]��K�K�	�"����c�$�-�-��)�*��:�:�!�$�*�*�*>�*>�*@�*�4�:�:�+?�+?�+/�=�=�)�:N�:N�P�G�����N�+����K�(�*�4�:�:�+?�+?�+/�=�=�+4�+@�+@�B�G��!�����0�0�2�G��K�K�'�%��
�7�)�1�=�>��}�}�S�X�X�d�^�,�,r*c�&�|jd�yr/)�_force_closerRs r�abortz_SelectorTransport.abortCs�����$�r*c� �||_d|_y�NT)�	_protocolr5)r)r3s  rr6z_SelectorTransport.set_protocolFs��!���#'�� r*c��|jSr/)rSrRs r�get_protocolz_SelectorTransport.get_protocolJs���~�~�r*c��|jSr/)r<rRs rr�z_SelectorTransport.is_closingMs���}�}�r*c�B�|j�xr
|jSr/)r�r=rRs rrz_SelectorTransport.is_readingPs���?�?�$�$�9�T�\�\�)9�9r*c���|j�syd|_|jj|j�|jj�rt
jd|�yy)NTz%r pauses reading)rr=rGrMr�	get_debugr
r!rRs rrz _SelectorTransport.pause_readingSsP����� ������
�
�!�!�$�-�-�0��:�:���!��L�L�,�d�3�"r*c���|js|jsyd|_|j|j|j�|j
j
�rtjd|�yy)NFz%r resumes reading)	r<r=rWr�_read_readyrGrYr
r!rRs rrz!_SelectorTransport.resume_reading[sW���=�=���������������(8�(8�9��:�:���!��L�L�-�t�4�"r*c�P�|jryd|_|jj|j�|jsa|xj
dz
c_|jj
|j�|jj|jd�yy�NTr)	r<rGrMrr:r;r��	call_soon�_call_connection_lostrRs rrJz_SelectorTransport.closecss���=�=����
��
�
�!�!�$�-�-�0��|�|��O�O�q� �O��J�J�%�%�d�m�m�4��J�J� � ��!;�!;�T�B�r*c�v�|j�-|d|��t|��|jj�yy)Nzunclosed transport )�source)r�ResourceWarningrJ)r)�_warns  r�__del__z_SelectorTransport.__del__ms5���:�:�!��'��x�0�/�$�O��J�J����"r*c��t|t�r4|jj�rDt	j
d||d��n*|jj
||||jd��|j|�y)Nz%r: %sTrd)rsrtr�r3)	r�rgrGrYr
r!rrSrO)r)r�rss   r�_fatal_errorz_SelectorTransport._fatal_errorrse���c�7�#��z�z�#�#�%����X�t�W�t�D��J�J�-�-�"� �!� �N�N�	/�
�	
���#�r*c��|jry|jr?|jj�|jj	|j
�|js,d|_|jj|j
�|xjdz
c_|jj|j|�yr])
r;r:�clearrGr�rr<rMr^r_)r)r�s  rrOz_SelectorTransport._force_close�s����?�?���<�<��L�L��� ��J�J�%�%�d�m�m�4��}�}� �D�M��J�J�%�%�d�m�m�4����1����
�
���T�7�7��=r*c��	|jr|jj|�|jj	�d|_d|_d|_|j}|�|j�d|_yy#|jj	�d|_d|_d|_|j}|�|j�d|_wwxYwr/)r5rS�connection_lostrrJrGr7�_detach)r)r�r-s   rr_z(_SelectorTransport._call_connection_lost�s���	$��'�'����.�.�s�3��J�J�����D�J�!�D�N��D�J��\�\�F��!���� �#���"��
�J�J�����D�J�!�D�N��D�J��\�\�F��!���� �#���"�s�'A?�?ACc�H�ttt|j��Sr/)�sum�mapr�r:rRs rrHz(_SelectorTransport.get_write_buffer_size�s���3�s�D�L�L�)�*�*r*c�b�|j�sy|jj||g|���yr/)rrGrWr�s    rrWz_SelectorTransport._add_reader�s*����� ����
�
���r�8�3�d�3r*)NN)zFatal error on transport)r#r&r'�max_sizerrrMrPr6rUr�rrrrJ�warnings�warnrdrfrOr_rHrWr+r,s@rr.r.sk����H�

�E�/�8-�8 �(���:�4�5�C�%�M�M��
�
>�$�+�4r*r.c����eZdZdZej
jZ		d�fd�	Z�fd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zded
dfd�Zd�Zd�Zd�Zd�Z�fd�Zd�Zd�Z�fd�Z�xZS)r1TNc���d|_t�|�	|||||�d|_d|_t
r|j|_n|j|_tj|j�|jj|jj|�|jj|j |j"|j$�|�,|jjt&j(|d�yyr)�_read_ready_cbrr�_eof�
_empty_waiter�_HAS_SENDMSG�_write_sendmsg�_write_ready�_write_sendr�_set_nodelayrrGr^rS�connection_maderWrr[r�_set_result_unless_cancelled)r)r�r2r3r4r,r-r"s       �rrz!_SelectorSocketTransport.__init__�s����#���
����t�X�u�f�=���	�!���� $� 3� 3�D�� $� 0� 0�D��	� � ����,��
�
���T�^�^�;�;�T�B��
�
���T�-�-�!�]�]�D�,<�,<�	>����J�J� � ��!E�!E�!'��
/�r*c���t|tj�r|j|_n|j
|_t�|�|�yr/)r�r	�BufferedProtocol�_read_ready__get_bufferru�_read_ready__data_receivedrr6)r)r3r"s  �rr6z%_SelectorSocketTransport.set_protocol�s<����h�	� :� :�;�"&�">�">�D��"&�"A�"A�D��
���X�&r*c�$�|j�yr/)rurRs rr[z$_SelectorSocketTransport._read_ready�s�����r*c��|jry	|jjd�}t|�st	d��		|jj|�}|s|j�y	|jj|�y#t
tf$r�t$r}|j|d�Yd}~yd}~wwxYw#ttf$rYyt
tf$r�t$r}|j|d�Yd}~yd}~wwxYw#t
tf$r�t$r}|j|d�Yd}~yd}~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.)r;rS�
get_bufferr�rGr�r�r�rfrr�rar`�_read_ready__on_eof�buffer_updated)r)r�r�r�s    rr�z0_SelectorSocketTransport._read_ready__get_buffer�sC���?�?��		��.�.�+�+�B�/�C��s�8�"�#J�K�K��	��Z�Z�)�)�#�.�F���$�$�&��	L��N�N�)�)�&�1��-�-�.�	���	�����F�
H���	�� �!1�2�	���-�.�	���	����c�#I�J���	���-�.�	���	L�����J�
L�
L��	L�sM�1B
�C�1D�
C�%B<�<C�D�D�,D�D�D?�#D:�:D?c���|jry	|jj|j�}|s|j�y	|jj|�y#tt
f$rYyttf$r�t$r}|j|d�Yd}~yd}~wwxYw#ttf$r�t$r}|j|d�Yd}~yd}~wwxYw)Nr�z2Fatal error: protocol.data_received() call failed.)
r;rr_rprar`r�r�r�rfr�rS�
data_received)r)r\r�s   rr�z3_SelectorSocketTransport._read_ready__data_received�s����?�?��	��:�:�?�?�4�=�=�1�D���$�$�&��	K��N�N�(�(��.�� �!1�2�	���-�.�	���	����c�#I�J���	���-�.�	���	K�����I�
K�
K��	K�s5�%A$�B+�$B(�5B(�B#�#B(�+C�C�Cc�x�|jj�rtjd|�	|jj�}|r&|jj|j�y|j�y#ttf$r�t$r}|j|d�Yd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.)
rGrYr
r!rS�eof_receivedr�r�r�rfrMrrJ)r)�	keep_openr�s   rr�z,_SelectorSocketTransport._read_ready__on_eof
s����:�:���!��L�L�*�D�1�	����3�3�5�I��
�J�J�%�%�d�m�m�4��J�J�L���-�.�	���	�����H�
J���	�s�B�B9�B4�4B9c�<�t|tttf�s!t	dt|�j����|jrtd��|j�td��|sy|jrH|jtjk\rtjd�|xjdz
c_
y|js]	|j j#|�}t|�|d}|sy|j0j3|j4|j6�|jj9|�|j;�y#t$t&f$rY�mt(t*f$r�t,$r}|j/|d�Yd}~yd}~wwxYw)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��bytes�	bytearrayr�r�r�r#rvrGrwr;r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr
�warningr:rrfrar`r�r�r�rfrGr�rrzrF�_maybe_pause_protocol)r)r\r�r�s    r�writez_SelectorSocketTransport.writes_���$��	�:� >�?��#�#'��:�#6�#6�"9�;�<�
<��9�9��F�G�G����)��I�J�J����?�?����)�"M�"M�M����@�A��O�O�q� �O���|�|�
��J�J�O�O�D�)��"�$�'���+�����J�J�"�"�4�=�=�$�2C�2C�D�	
�����D�!��"�"�$��!$�%5�6�
��� 1�2�
�� �
��!�!�#�'N�O���
�s�E�F�(F�?F�Fc�J�tj|jt�Sr/)�	itertools�islicer:rrRs r�_get_sendmsg_bufferz,_SelectorSocketTransport._get_sendmsg_bufferFs��������j�9�9r*c��|jsJd��|jry	|jj|j	��}|j|�|j
�|js�|jj|j�|j�|jjd�|jr|jd�y|jr*|jjt j"�yyy#t$t&f$rYyt(t*f$r�t,$r�}|jj|j�|jj/�|j1|d�|j� |jj3|�Yd}~yYd}~yd}~wwxYw�NzData should not be emptyr�)r:r;rrr��_adjust_leftover_buffer�_maybe_resume_protocolrGr�rrwr�r<r_rv�shutdownrT�SHUT_WRrar`r�r�r�rhrfr�)r)r�r�s   rryz'_SelectorSocketTransport._write_sendmsgIsh���|�|�7�7�7�|��?�?��	8��Z�Z�'�'��(@�(@�(B�C�F��(�(��0�
�'�'�)��<�<��
�
�)�)�$�-�-�8��%�%�1��&�&�1�1�$�7��=�=��.�.�t�4��Y�Y��J�J�'�'����7��
 �� �!1�2�	���-�.�	���	6��J�J�%�%�d�m�m�4��L�L��� ����c�#J�K��!�!�-��"�"�0�0��5�5�.��		6�s�:D�G	�+G	�A8G�G	r��returnc��|j}|r?|j�}t|�}||kr||z}n|j||d�y|r�>yyr/)r:�popleftr��
appendleft)r)r��buffer�b�b_lens     rr�z0_SelectorSocketTransport._adjust_leftover_bufferesO���������� �A���F�E�����%����!�!�!�F�G�*�-��r*c���|jsJd��|jry	|jj�}|jj	|�}|t|�k7r|jj
||d�|j�|js�|jj|j�|j�|jjd�|jr|jd�y|jr*|jj!t"j$�yyy#t&t(f$rYyt*t,f$r�t.$r�}|jj|j�|jj1�|j3|d�|j� |jj5|�Yd}~yYd}~yd}~wwxYwr�)r:r;r�rrfr�r�r�rGr�rrwr�r<r_rvr�rTr�rar`r�r�r�rhrfr�)r)r�r�r�s    rr{z$_SelectorSocketTransport._write_sendps����|�|�7�7�7�|��?�?��	8��\�\�)�)�+�F��
�
����'�A��C��K�����'�'��q�r�
�3�
�'�'�)��<�<��
�
�)�)�$�-�-�8��%�%�1��&�&�1�1�$�7��=�=��.�.�t�4��Y�Y��J�J�'�'����7��
 �� �!1�2�	���-�.�	���	6��J�J�%�%�d�m�m�4��L�L��� ����c�#J�K��!�!�-��"�"�0�0��5�5�.��		6�s�A!E�G0�G0�)A8G+�+G0c��|js|jryd|_|js*|jj	t
j�yyrR)r<rvr:rr�rTr�rRs r�	write_eofz"_SelectorSocketTransport.write_eof�s;���=�=�D�I�I����	��|�|��J�J������/�r*c�n�|jrtd��|j�td��|sy|jj	|D�cgc]
}t|���c}�|j
�|jr1|jj|j|j�yycc}w)Nz*Cannot call writelines() after write_eof()z-unable to writelines; sendfile is in progress)
rvrGrwr:�extendr�rzrGr�r)r)�list_of_datar\s   r�
writelinesz#_SelectorSocketTransport.writelines�s����9�9��K�L�L����)��N�O�O��������,�G�$�Z��-�G�H������<�<��J�J�"�"�4�=�=�$�2C�2C�D���Hs�B2c��yrRrZrRs r�
can_write_eofz&_SelectorSocketTransport.can_write_eof�s��r*c���t�|�|�|j�%|jjt	d��yy)NzConnection is closed by peer)rr_rwr��ConnectionError)r)r�r"s  �rr_z._SelectorSocketTransport._call_connection_lost�s?���
��%�c�*����)����,�,�� >�?�
A�*r*c���|j�td��|jj�|_|js|jjd�|jS)NzEmpty waiter is already set)rwrGrGr�r:r�rRs rrz+_SelectorSocketTransport._make_empty_waiter�sV�����)��<�=�=�!�Z�Z�5�5�7����|�|����)�)�$�/��!�!�!r*c��d|_yr/)rwrRs rrz,_SelectorSocketTransport._reset_empty_waiter�s
��!��r*c�>��d|_d|_t�|�
�yr/)rurzrrJrKs �rrJz_SelectorSocketTransport.close�s���"��� ���
��
�r*r%)r#r&r'�_start_tls_compatibler�
_SendfileMode�
TRY_NATIVE�_sendfile_compatiblerr6r[r�r�r�r�r�ryr�r�r{r�r�r�r_rrrJr+r,s@rr1r1�s���� ��$�2�2�=�=��48�$(�/�2'��#L�JK�2�*%%�N:�8�8	�c�	�d�	�8�>0�E��A�"�"��r*r1c�V��eZdZejZ		d�fd�	Zd�Zd�Zdd�Z	d�Z
�xZS)rBc�x��t�|�||||�||_d|_|jj|jj|�|jj|j|j|j�|�,|jjtj|d�yyr�)
rr�_address�_buffer_sizerGr^rSr}rWrr[rr~)r)r�r2r3rCr4r,r"s       �rrz#_SelectorDatagramTransport.__init__�s����
����t�X�u�5���
�����
�
���T�^�^�;�;�T�B��
�
���T�-�-�!�]�]�D�,<�,<�	>����J�J� � ��!E�!E�!'��
/�r*c��|jSr/)r�rRs rrHz0_SelectorDatagramTransport.get_write_buffer_size�s��� � � r*c��|jry	|jj|j�\}}|jj||�y#ttf$rYyt$r%}|jj|�Yd}~yd}~wttf$r�t$r}|j|d�Yd}~yd}~wwxYw)Nz&Fatal read error on datagram transport)r;rr�rprS�datagram_receivedrar`rg�error_receivedr�r�r�rf�r)r\r�r�s    rr[z&_SelectorDatagramTransport._read_ready�s����?�?��	9����,�,�T�]�]�;�J�D�$�
�N�N�,�,�T�4�8�� �!1�2�	���	/��N�N�)�)�#�.�.���-�.�	���	M����c�#K�L�L��	M�s)�(A�C�%C�-B
�
C�(B?�?Cc�Z�t|tttf�s!t	dt|�j����|sy|jr4|d|jfvrtd|j����|j}|jrT|jrH|jtjk\rtjd�|xjdz
c_	y|jsI	|jdr|j j#|�y|j j%||�y|jjAt|�|f�|xjBtE|�z
c_!|jG�y#t&t(f$r3|j*j-|j.|j0�Y��t2$r%}|j4j7|�Yd}~yd}~wt8t:f$r�t<$r}|j?|d�Yd}~yd}~wwxYw)Nr�z!Invalid address: must be None or r�rrr�'Fatal write error on datagram transport)$r�r�r�r�r�r�r#r�r�r;rr�r
r�r:r1rrfr�rar`rGr�r�
_sendto_readyrgrSr�r�r�r�rfrFr�r�r�r�s    rr�z!_SelectorDatagramTransport.sendto�s����$��	�:� >�?��#�#'��:�#6�#6�"9�;�<�
<����=�=��D�$�-�-�0�0� �7��
�
��G�I�I��=�=�D��?�?�t�}�}����)�"M�"M�M����@�A��O�O�q� �O���|�|�
��;�;�z�*��J�J�O�O�D�)���J�J�%�%�d�D�1��	
�����U�4�[�$�/�0����S��Y�&���"�"�$��$�%5�6�
J��
�
�&�&�t�}�}�d�6H�6H�I��
����-�-�c�2���� 1�2�
�� �
��!�!��B�D���
�s0�-*F
�F
�
?H*�H*�G3�3H*�H%�%H*c�X�|jr�|jj�\}}|xjt|�zc_	|jdr|j
j
|�n|j
j||�|jr��|j%�|jsD|j&j)|j*�|j,r|j/d�yyy#ttf$r>|jj||f�|xjt|�z
c_Y��t$r%}|jj|�Yd}~yd}~wttf$r�t $r}|j#|d�Yd}~yd}~wwxYw)Nrrr�)r:r�r�r�r1rrfr�rar`r�rgrSr�r�r�r�rfr�rGr�rr<r_r�s    rr�z(_SelectorDatagramTransport._sendto_readysQ���l�l����-�-�/�J�D�$�����T��*��
��;�;�z�*��J�J�O�O�D�)��J�J�%�%�d�D�1��l�l�,	
�#�#�%��|�|��J�J�%�%�d�m�m�4��}�}��*�*�4�0����$�%5�6�
����'�'��t��5��!�!�S��Y�.�!���
����-�-�c�2���� 1�2�
�� �
��!�!��B�D���
�s,�	AC>�>A
F)�
F)�E2�2F)�
F$�$F)r%r/)r#r&r'r8r9�_buffer_factoryrrHr[r�r�r+r,s@rrBrB�s.���!�'�'�O�59�$(�/�!�9� *%�X1r*rB)&r(�__all__r8rzr�r��osrrTrqr&�ssl�ImportError�rrrrr	r
rr�logr
�hasattrrx�sysconfrrgr�
BaseEventLoopr�_FlowControlMixin�	Transportr.r1�DatagramTransportrBrZr*r�<module>r�s���#������	��
���������������v�}�}�i�0�����R�Z�Z��-�
�
(�I�K�5�5�I�X_4��5�5�#�-�-�_4�DW�1�W�tl1�!3�Z�5Q�5Q�l1��S%��
�C���$�����s#�C&�:C3�&C0�/C0�3C=�<C=

Zerion Mini Shell 1.0