Your IP : 3.141.41.109


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

�

�Q�f܂���	dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZd
�ZGd�dej(ej*�ZGd�deej.�ZGd�deej2�ZGd�de�ZGd�deej8�ZGd�deeej<�ZGd�deeej<�Z Gd�de	jB�Z"y))�BaseProactorEventLoop�N�)�base_events)�	constants)�futures)�
exceptions)�	protocols)�sslproto)�
transports)�trsock)�loggerc���tj|�|jd<	|j�|jd<d|jvr	|j�|jd<yy#tj
$r5|jj�rtjd|d��Y�uwxYw#tj
$rd|jd<YywxYw)N�socket�socknamezgetsockname() failed on %rT��exc_info�peername)r�TransportSocket�_extra�getsocknamer�error�_loop�	get_debugr
�warning�getpeername)�	transport�socks  �>/opt/alt/python312/lib64/python3.12/asyncio/proactor_events.py�_set_socket_extrars���!'�!7�!7��!=�I���X��C�'+�'7�'7�'9�	����$���)�)�)�	0�+/�+;�+;�+=�I���Z�(�*���<�<�C��?�?�$�$�&��N�N�,�d�T�
C��C���|�|�	0�+/�I���Z�(�	0�s$�A/�B:�/AB7�6B7�:"C�Cc���eZdZ			d
�fd�	Zd�Zd�Zd�Zd�Zd�Zd�Z	e
jfd�Zdd	�Z
d
�Zd�Zd�Z�xZS)�_ProactorBasePipeTransportc���t�|�||�|j|�||_|j	|�||_d|_d|_d|_d|_	d|_
d|_d|_d|_
|j
�|j
j�|jj!|j"j$|�|�,|jj!t&j(|d�yy)NrF)�super�__init__�
_set_extra�_sock�set_protocol�_server�_buffer�	_read_fut�
_write_fut�_pending_write�
_conn_lost�_closing�_called_connection_lost�_eof_written�_attachr�	call_soon�	_protocol�connection_mader�_set_result_unless_cancelled��self�loopr�protocol�waiter�extra�server�	__class__s       �rr$z#_ProactorBasePipeTransport.__init__2s����
�����%��������
����(�#���������������������
�',��$�!����<�<�#��L�L� � �"��
�
���T�^�^�;�;�T�B����J�J� � ��!E�!E�!'��
/��c��|jjg}|j�|jd�n|jr|jd�|j�,|jd|jj����|j�|jd|j���|j�|jd|j���|jr'|jdt|j����|jr|jd�djd	j|��S)
N�closed�closingzfd=zread=zwrite=zwrite_bufsize=zEOF writtenz<{}>� )
r=�__name__r&�appendr.�filenor*r+r)�lenr0�format�join)r7�infos  r�__repr__z#_ProactorBasePipeTransport.__repr__Is������'�'�(���:�:���K�K��!�
�]�]��K�K�	�"��:�:�!��K�K�#�d�j�j�/�/�1�2�3�4��>�>�%��K�K�%����1�2�3��?�?�&��K�K�&���� 3�4�5��<�<��K�K�.��T�\�\�):�(;�<�=�����K�K�
�&��}�}�S�X�X�d�^�,�,r>c�"�||jd<y)N�pipe)r�r7rs  rr%z%_ProactorBasePipeTransport._set_extra[s��"����F�r>c��||_y�N�r3)r7r9s  rr'z'_ProactorBasePipeTransport.set_protocol^s	��!��r>c��|jSrOrP�r7s r�get_protocolz'_ProactorBasePipeTransport.get_protocolas���~�~�r>c��|jSrO)r.rRs r�
is_closingz%_ProactorBasePipeTransport.is_closingds���}�}�r>c�.�|jryd|_|xjdz
c_|js2|j�&|jj|jd�|j�"|jj�d|_yy)NTr)	r.r-r)r+rr2�_call_connection_lostr*�cancelrRs r�closez _ProactorBasePipeTransport.closegsq���=�=����
����1����|�|���� 7��J�J� � ��!;�!;�T�B��>�>�%��N�N�!�!�#�!�D�N�&r>c�v�|j�-|d|��t|��|jj�yy)Nzunclosed transport )�source)r&�ResourceWarningrY)r7�_warns  r�__del__z"_ProactorBasePipeTransport.__del__rs5���:�:�!��'��x�0�/�$�O��J�J����"r>c�0�	t|t�r4|jj�rDt	j
d||d��n*|jj
||||jd��|j|�y#|j|�wxYw)Nz%r: %sTr)�message�	exceptionrr9)	�
isinstance�OSErrorrrr
�debug�call_exception_handlerr3�_force_close)r7�excr`s   r�_fatal_errorz'_ProactorBasePipeTransport._fatal_errorwsy��	#��#�w�'��:�:�'�'�)��L�L��4��4�H��
�
�1�1�&�!$�!%� $���	3��
���c�"��D���c�"�s�A.B�Bc�H�|j�S|jj�s9|�|jjd�n|jj|�|jr
|j
ryd|_|xjdz
c_|jr!|jj�d|_|jr!|jj�d|_	d|_
d|_|jj|j|�y)NTrr)�
_empty_waiter�done�
set_result�
set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rgs  rrfz'_ProactorBasePipeTransport._force_close�s������)�$�2D�2D�2I�2I�2K��{��"�"�-�-�d�3��"�"�0�0��5��=�=�T�9�9����
����1����?�?��O�O�"�"�$�"�D�O��>�>��N�N�!�!�#�!�D�N��������
�
���T�7�7��=r>c��|jry	|jj|�t|jd�rF|jj�dk7r)|jj
tj�|jj�d|_|j}|�|j�d|_
d|_y#t|jd�rF|jj�dk7r)|jj
tj�|jj�d|_|j}|�|j�d|_
d|_wxYw)N�shutdown���T)r/r3�connection_lost�hasattrr&rEror�	SHUT_RDWRrYr(�_detach)r7rgr<s   rrWz0_ProactorBasePipeTransport._call_connection_lost�s���'�'��	0��N�N�*�*�3�/��t�z�z�:�.�4�:�:�3D�3D�3F�"�3L��
�
�#�#�F�$4�$4�5��J�J�����D�J��\�\�F��!���� �#���+/�D�(���t�z�z�:�.�4�:�:�3D�3D�3F�"�3L��
�
�#�#�F�$4�$4�5��J�J�����D�J��\�\�F��!���� �#���+/�D�(�s�C�B+E?c�f�|j}|j�|t|j�z
}|SrO)r,r)rF)r7�sizes  r�get_write_buffer_sizez0_ProactorBasePipeTransport.get_write_buffer_size�s/���"�"���<�<�#��C����%�%�D��r>�NNN)zFatal error on pipe transport)rC�
__module__�__qualname__r$rJr%r'rSrUrY�warnings�warnr^rhrfrWrw�
__classcell__�r=s@rr!r!.sQ���4�48�$(�/�.-�$#�"���	"�%�M�M��

#�>�(0�(r>r!c�L��eZdZ			d�fd�	Zd�Zd�Zd�Zd�Zd�Zd	d�Z	�xZ
S)
�_ProactorReadPipeTransportc����d|_d|_t�|�
||||||�t	|�|_|jj|j�d|_y)NrpTF)	�_pending_data_length�_pausedr#r$�	bytearray�_datarr2�
_loop_reading)	r7r8rr9r:r;r<�buffer_sizer=s	        �rr$z#_ProactorReadPipeTransport.__init__�sT���$&��!����
����t�X�v�u�f�E��{�+��
��
�
���T�/�/�0���r>c�:�|jxr
|jSrO)r�r.rRs r�
is_readingz%_ProactorReadPipeTransport.is_reading�s���<�<��5��
�
�$5�5r>c��|js|jryd|_|jj�rt	j
d|�yy)NTz%r pauses reading)r.r�rrr
rdrRs r�
pause_readingz(_ProactorReadPipeTransport.pause_reading�s?���=�=�D�L�L������:�:���!��L�L�,�d�3�"r>c��|js|jsyd|_|j�&|jj	|j
d�|j}d|_|dkDr4|jj	|j|jd||�|jj�rtjd|�yy)NFrpz%r resumes reading)r.r�r*rr2r�r��_data_receivedr�rr
rd)r7�lengths  r�resume_readingz)_ProactorReadPipeTransport.resume_reading�s����=�=���������>�>�!��J�J� � ��!3�!3�T�:��*�*��$&��!��B�;�
�J�J� � ��!4�!4�d�j�j��&�6I�6�R��:�:���!��L�L�-�t�4�"r>c�.�|jj�rtjd|�	|jj�}|s|j�yy#ttf$r�t$r}|j|d�Yd}~yd}~wwxYw)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.)rrr
rdr3�eof_received�
SystemExit�KeyboardInterrupt�
BaseExceptionrhrY)r7�	keep_openrgs   r�
_eof_receivedz(_ProactorReadPipeTransport._eof_received�s����:�:���!��L�L�*�D�1�	����3�3�5�I���J�J�L����-�.�	���	�����H�
J���	�s�A � B�8B�Bc��|jr||_y|dk(r|j�yt|jt
j�r"	tj|j|�y|jj|�y#ttf$r�t$r}|j|d�Yd}~yd}~wwxYw)Nrz3Fatal error: protocol.buffer_updated() call failed.)
r�r�r�rbr3r	�BufferedProtocol�_feed_data_to_buffered_protor�r�r�rh�
data_received)r7�datar�rgs    rr�z)_ProactorReadPipeTransport._data_received�s����<�<�)/�D�%���Q�;���� ���d�n�n�i�&@�&@�A�
��6�6�t�~�~�t�L�
�N�N�(�(��.��� 1�2�
�� �
��!�!�#�#1�2���	
�s� B
�
C�%B<�<Cc�J�d}d}	|�xd|_|j�rQ|j�}|dk(r	|dkDr|j||�yyt	t|j�d|�}n|j�|jr	|dkDr|j||�yy|js?|jjj|j|j�|_|js&|jj|j�	|dkDr|j||�yy#t $rZ}|js|j#|d�n1|jj%�rt'j(dd��Yd}~�wd}~wt*$r}|j-|�Yd}~��d}~wt.$r}|j#|d�Yd}~��d}~wt0j2$r|js�Y��wxYw#|dkDr|j||�wwxYw)Nrprz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*rk�resultr��bytes�
memoryviewr�rXr.r�r�	_proactor�	recv_intor&�add_done_callbackr��ConnectionAbortedErrorrhrr
rd�ConnectionResetErrorrfrcr�CancelledError)r7�futr�r�rgs     rr�z(_ProactorReadPipeTransport._loop_readings�������.	2���"&����8�8�:� �Z�Z�\�F���{��F��{��#�#�D�&�1��A!��D�J�J�!7���!@�A�D��J�J�L��}�}��2��{��#�#�D�&�1��)�<�<�!%���!5�!5�!?�!?��
�
�D�J�J�!W����<�<����0�0��1C�1C�D���{��#�#�D�&�1���#&�	,��=�=��!�!�#�'K�L����%�%�'����I�&*�,���#�	#����c�"�"���	I����c�#G�H�H���(�(�	��=�=��!�	����{��#�#�D�&�1��sm�.D<�>D<�&AD<�12H�<	H�AF�H�H�&F<�7H�<H�G�H�#H�H�H�H�H")NNNirO)rCryrzr$r�r�r�r�r�r�r}r~s@rr�r��s/���#�48�6;��6�4�&5�$� /�212r>r�c�P��eZdZ	dZ�fd�Zd�Zd
d�Zd�Zd�Zd�Z	d�Z
d	�Z�xZS)�_ProactorBaseWritePipeTransportTc�2��t�|�|i|��d|_yrO)r#r$rj�r7�args�kwr=s   �rr$z(_ProactorBaseWritePipeTransport.__init__Ns���
���$�%�"�%�!��r>c��t|tttf�s!t	dt|�j����|jrtd��|j�td��|sy|jrH|jtjk\rtjd�|xjdz
c_
y|j�|j!t|���y|j"s!t|�|_|j%�y|j"j'|�|j%�y)Nz/data argument must be a bytes-like object, not zwrite_eof() already calledz(unable to write; sendfile is in progresszsocket.send() raised exception.r)r�)rbr�r�r��	TypeError�typerCr0�RuntimeErrorrjr-r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr
rr+�
_loop_writingr)�_maybe_pause_protocol�extend)r7r�s  r�writez%_ProactorBaseWritePipeTransport.writeRs���$��	�:� >�?����D�z�*�*�+�-�.�
.�����;�<�<����)��I�J�J����?�?����)�"M�"M�M����@�A��O�O�q� �O���?�?�"�
���E�$�K��0����$�T�?�D�L��&�&�(�
�L�L����%��&�&�(r>c��	|�|j�
|jryd|_d|_|r|j�|�|j}d|_|sx|jr&|j
j
|jd�|jr)|jjtj�|j�n�|j
jj|j|�|_|jj!�sFt#|�|_|jj%|j&�|j)�n%|jj%|j&�|j*�)|j�|j*j-d�yyy#t.$r}|j1|�Yd}~yd}~wt2$r}|j5|d�Yd}~yd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,r�r)rr2rWr0r&ror�SHUT_WR�_maybe_resume_protocolr��sendrkrFr�r�r�rjrlr�rfrcrh)r7�fr�rgs    rr�z-_ProactorBaseWritePipeTransport._loop_writingxs���&	J��}����!8�T�]�]��"�D�O�"#�D������
��|��|�|��#�����=�=��J�J�(�(��)C�)C�T�J��$�$��J�J�'�'����7��+�+�-�"&�*�*�"6�"6�";�";�D�J�J��"M������+�+�-�*-�d�)�D�'��O�O�5�5�d�6H�6H�I��.�.�0��O�O�5�5�d�6H�6H�I��!�!�-�$�/�/�2I��"�"�-�-�d�3�3J�-��#�	#����c�"�"���	J����c�#H�I�I��	J�s)�F<�FF<�<	H�G�H�'G>�>Hc��y�NT�rRs r�
can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eof����r>c�$�|j�yrO)rYrRs r�	write_eofz)_ProactorBaseWritePipeTransport.write_eof�s���
�
�r>c�&�|jd�yrO�rfrRs r�abortz%_ProactorBaseWritePipeTransport.abort�������$�r>c���|j�td��|jj�|_|j�|jjd�|jS)NzEmpty waiter is already set)rjr�r�
create_futurer+rlrRs r�_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waiter�sY�����)��<�=�=�!�Z�Z�5�5�7����?�?�"����)�)�$�/��!�!�!r>c��d|_yrO)rjrRs r�_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiter�s
��!��r>�NN)
rCryrz�_start_tls_compatibler$r�r�r�r�r�r�r�r}r~s@rr�r�Hs7���$� ��"�$)�L'J�R�� �"�"r>r�c�$��eZdZ�fd�Zd�Z�xZS)�_ProactorWritePipeTransportc����t�|�|i|��|jjj	|j
d�|_|jj|j�y)N�)	r#r$rr��recvr&r*r��_pipe_closedr�s   �rr$z$_ProactorWritePipeTransport.__init__�sO���
���$�%�"�%����-�-�2�2�4�:�:�r�B������(�(��):�):�;r>c��|j�ry|jryd|_|j�|j	t��y|j
�yrO)�	cancelledr.r*r+rf�BrokenPipeErrorrY)r7r�s  rr�z(_ProactorWritePipeTransport._pipe_closed�sC���=�=�?���=�=������?�?�&����o�/�0��J�J�Lr>)rCryrzr$r�r}r~s@rr�r��s
���<�

r>r�c�R��eZdZdZ		d	�fd�	Zd�Zd�Zd�Zd
d�Zd
d�Z	d
d�Z
�xZS)�_ProactorDatagramTransportic����||_d|_d|_t�|�|||||��tj�|_|jj|j�y)Nr)r:r;)�_addressrj�_buffer_sizer#r$�collections�dequer)rr2r�)r7r8rr9�addressr:r;r=s       �rr$z#_ProactorDatagramTransport.__init__�s^�����
�!������	����t�X�f�E��J�#�(�(�*����
�
���T�/�/�0r>c��t||�yrO�rrMs  rr%z%_ProactorDatagramTransport._set_extra�����$��%r>c��|jSrO)r�rRs rrwz0_ProactorDatagramTransport.get_write_buffer_size�s��� � � r>c�&�|jd�yrOr�rRs rr�z _ProactorDatagramTransport.abort�r�r>c�r�t|tttf�st	dt|���|sy|j�(|d|jfvrtd|j����|jrT|jrH|jtjk\rtjd�|xjdz
c_y|jjt|�|f�|xjt!|�z
c_|j"�|j%�|j'�y)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rbr�r�r�r�r�r��
ValueErrorr-rr�r
rr)rDr�rFr+r�r�)r7r��addrs   r�sendtoz!_ProactorDatagramTransport.sendto�s����$��	�:� >�?��J� ��J�(�
(����=�=�$��d�D�M�M�5J�)J��3�D�M�M�?�C�E�
E��?�?�t�}�}����)�"M�"M�M����B�C��O�O�q� �O��	
�����U�4�[�$�/�0����S��Y�&���?�?�"���� �	
�"�"�$r>c�z�	|jryd|_|r|j�|jr|jr?|jr3|j
r&|jj|jd�y|jj�\}}|xjt|�zc_
|j�6|jjj|j|�|_n7|jjj|j||��|_|jj!|j"�|j%�y#t&$r%}|j(j+|�Yd}~yd}~wt,$r}|j/|d�Yd}~yd}~wwxYw)N)r�z'Fatal write error on datagram transport)r-r+r�r)r�r.rr2rW�popleftr�rFr�r�r&r�r�r�r�rcr3�error_received�	Exceptionrh)r7r�r�r�rgs     rr�z(_ProactorDatagramTransport._loop_writingsT��	*�����#�D�O���
�
���<�<�D�O�O��
�
��=�=��J�J�(�(��)C�)C�T�J�����-�-�/�J�D�$�����T��*���}�}�(�"&�*�*�"6�"6�";�";�D�J�J�<@�#B���#'�*�*�"6�"6�"=�"=�d�j�j�>B�CG�#>�#I���
�O�O�-�-�d�.@�.@�A��'�'�)��
�	/��N�N�)�)�#�.�.���	N����c�#L�M�M��	N�s0�E)�A/E)�?B4E)�)	F:�2F�F:�F5�5F:c�2�d}	|jr!	|r|jj|�yyd|_|�_|j	�}|j
r#d}	|r|jj|�yy|j�||j}}n|\}}|jr!	|r|jj|�yy|j�@|jjj|j|j�|_n?|jjj|j|j�|_|j�&|jj|j�	|r|jj|�yy#t$r%}|jj!|�Yd}~�Id}~wt"j$$r|j
s�Y�nwxYw#|r|jj|�wwxYwrO)r-r3�datagram_receivedr*r�r.r�rr�r�r&�max_size�recvfromr�r�rcr�rr�)r7r�r�r��resrgs      rr�z(_ProactorDatagramTransport._loop_reading$s�����'	=�����H����0�0��t�<��?"�D�N����j�j�l���=�=��D��0����0�0��t�<��-�=�=�,�!$�d�m�m�$�D�!$�J�D�$����� ����0�0��t�<���}�}�(�!%���!5�!5�!:�!:�4�:�:�;?�=�=�"J���"&���!5�!5�!>�!>�t�z�z�?C�}�}�"N����~�~�)����0�0��1C�1C�D�����0�0��t�<����	/��N�N�)�)�#�.�.���(�(�	��=�=��!�	������0�0��t�<��sM�F#�'F#�9,F#�BF#�2G5�#	G2�,G�G5�#G2�/G5�1G2�2G5�5!HrxrO)rCryrzr�r$r%rwr�r�r�r�r}r~s@rr�r��s2����H�59�$(�1�&�!� �%�: *�D)=r>r�c��eZdZ	d�Zd�Zy)�_ProactorDuplexPipeTransportc��y)NFr�rRs rr�z*_ProactorDuplexPipeTransport.can_write_eofUs��r>c��t�rO)�NotImplementedErrorrRs rr�z&_ProactorDuplexPipeTransport.write_eofXs��!�!r>N)rCryrzr�r�r�r>rr�r�Ps��&��"r>r�c�d��eZdZ	ejj
Z		d�fd�	Zd�Zd�Z	d�Z
�xZS)�_ProactorSocketTransportc�X��t�|�||||||�tj|�yrO)r#r$r�_set_nodelayr6s       �rr$z!_ProactorSocketTransport.__init__cs(���
����t�X�v�u�f�E�� � ��&r>c��t||�yrOr�rMs  rr%z#_ProactorSocketTransport._set_extrahr�r>c��yr�r�rRs rr�z&_ProactorSocketTransport.can_write_eofkr�r>c��|js|jryd|_|j�*|jj	t
j�yyr�)r.r0r+r&rorr�rRs rr�z"_ProactorSocketTransport.write_eofnsA���=�=�D�-�-�� ����?�?�"��J�J������/�#r>rx)rCryrzr�
_SendfileMode�
TRY_NATIVE�_sendfile_compatibler$r%r�r�r}r~s@rr�r�\s4���+�$�2�2�=�=��48�$(�'�
&��0r>r�c����eZdZ�fd�Z		dd�Z	dddddddd�d�Z	dd�Z		d d�Z		d d	�Z		d d
�Z	�fd�Z
d�Zd
�Zd�Z
d!d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Z			d"d�Zd�Zd�Zd�Z�xZS)#rc���t�|��tjd|jj
�||_||_d|_i|_	|j|�|j�tj�tj�ur.tj |j"j%��yy)NzUsing proactor: %s)r#r$r
rdr=rCr��	_selector�_self_reading_future�_accept_futures�set_loop�_make_self_pipe�	threading�current_thread�main_thread�signal�
set_wakeup_fd�_csockrE)r7�proactorr=s  �rr$zBaseProactorEventLoop.__init__xs����
�������)�8�+=�+=�+F�+F�G�!���!���$(��!�!������$�������#�#�%��)>�)>�)@�@�� � ����!3�!3�!5�6�Ar>Nc�"�t||||||�SrO)r�)r7rr9r:r;r<s      r�_make_socket_transportz,BaseProactorEventLoop._make_socket_transport�s��'��d�H�f�(-�v�7�	7r>F)�server_side�server_hostnamer;r<�ssl_handshake_timeout�ssl_shutdown_timeoutc
�t�tj|||||||	|
��}t|||||��|jS)N)rr�r;r<)r
�SSLProtocolr��_app_transport)r7�rawsockr9�
sslcontextr:rrr;r<rr�ssl_protocols            r�_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transport�sI�� �+�+��h�
�F��_�&;�%9�	;��
	!��w��',�V�	=��*�*�*r>c�"�t||||||�SrO)r�)r7rr9r�r:r;s      r�_make_datagram_transportz.BaseProactorEventLoop._make_datagram_transport�s��)�$��h��*0�%�9�	9r>c� �t|||||�SrO)r��r7rr9r:r;s     r�_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transport�s��+�D�,0�(�F�E�K�	Kr>c� �t|||||�SrO)r�rs     r�_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transport�s��)�$��h���N�Nr>c� �t|||||�SrO)r�rs     r�_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transport�s��+�4�+/��6�5�J�	Jr>c���|j�rtd��|j�rytj�tj
�urt
jd�|j�|j�|jj�d|_
d|_t�|�-�y)Nz!Cannot close a running event looprp)�
is_runningr��	is_closedrrrr	r
�_stop_accept_futures�_close_self_piper�rYrr#)r7r=s �rrYzBaseProactorEventLoop.close�s�����?�?���B�C�C��>�>����#�#�%��)>�)>�)@�@�� � ��$�	
�!�!�#�����������������	��
�r>c��VK�|jj||��d{���S7��wrO)r�r�)r7r�ns   r�	sock_recvzBaseProactorEventLoop.sock_recv�s#�����^�^�(�(��q�1�1�1�1��� )�'�)c��VK�|jj||��d{���S7��wrO)r�r�)r7r�bufs   r�sock_recv_intoz$BaseProactorEventLoop.sock_recv_into�s#�����^�^�-�-�d�C�8�8�8�8�r,c��VK�|jj||��d{���S7��wrO)r�r�)r7r�bufsizes   r�
sock_recvfromz#BaseProactorEventLoop.sock_recvfrom�s#�����^�^�,�,�T�7�;�;�;�;�r,c��rK�|st|�}|jj|||��d{���S7��wrO)rFr��
recvfrom_into)r7rr.�nbytess    r�sock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_into�s1�������X�F��^�^�1�1�$��V�D�D�D�D�s�.7�5�7c��VK�|jj||��d{���S7��wrO)r�r�)r7rr�s   r�sock_sendallz"BaseProactorEventLoop.sock_sendall�s#�����^�^�(�(��t�4�4�4�4�r,c��ZK�|jj||d|��d{���S7��w)Nr)r�r�)r7rr�r�s    r�sock_sendtoz!BaseProactorEventLoop.sock_sendto�s'�����^�^�*�*�4��q�'�B�B�B�B�s�"+�)�+c��K�|jr|j�dk7rtd��|jj	||��d{���S7��w)Nrzthe socket must be non-blocking)�_debug�
gettimeoutr�r��connect)r7rr�s   r�sock_connectz"BaseProactorEventLoop.sock_connect�sD�����;�;�4�?�?�,��1��>�?�?��^�^�+�+�D�'�:�:�:�:�s�A
A�A�
Ac��TK�|jj|��d{���S7��wrO)r��acceptrMs  r�sock_acceptz!BaseProactorEventLoop.sock_accept�s!�����^�^�*�*�4�0�0�0�0�s�(�&�(c��K�	|j�}	t
j|�j}|r|n|}|syt|d�}|rt||z|�n|}	t||�}d}
		t|	|z
|�}|dkr|
|
dkDr|j|�SS|jj||||��d{���||z
}|
|z
}
�^#ttjf$r}t	j
d��d}~wwxYw#t$rt	j
d��wxYw7�g#|
dkDr|j|�wwxYw�w)Nznot a regular filerl��)rE�AttributeError�io�UnsupportedOperationr�SendfileNotAvailableError�os�fstat�st_sizerc�min�seekr��sendfile)r7r�file�offset�countrE�err�fsize�	blocksize�end_pos�
total_sents           r�_sock_sendfile_nativez+BaseProactorEventLoop._sock_sendfile_native�s_����	M��[�[�]�F�	M��H�H�V�$�,�,�E�#�E��	����	�;�/�	�05�#�f�u�n�e�,�5���V�U�#���
�
	"����&� 0�)�<�	���>�%�
�A�~��	�	�&�!��	�n�n�-�-�d�D�&�)�L�L�L��)�#���i�'�
�
���� 7� 7�8�	M��6�6�7K�L�L��	M���	M��6�6�7K�L�L�	M��M���A�~��	�	�&�!��sh�E�C
�D�6E�+D$�E�!D$�:D"�;D$�
C=�#C8�8C=�=E�D�E�"D$�$D=�=Ec��jK�|j�}|j�|j��d{���	|j|j|||d���d{���|j�|r|j
�SS7�P7�)#|j�|r|j
�wwxYw�w)NF)�fallback)r�r�r��
sock_sendfiler&r�r�)r7�transprNrOrPr�s      r�_sendfile_nativez&BaseProactorEventLoop._sendfile_native�s������*�*�,�������'�'�)�)�)�	(��+�+�F�L�L�$���5:�,�<�<�
�&�&�(���%�%�'��
	*��<��
�&�&�(���%�%�'��s8�4B3�B�B3�#B�B	� B�#%B3�	B�%B0�0B3c��|j�!|jj�d|_|jj�d|_|jj�d|_|xj
dzc_y)Nr)rrX�_ssockrYr�
_internal_fdsrRs rr(z&BaseProactorEventLoop._close_self_pipesg���$�$�0��%�%�,�,�.�(,�D�%����������������������a��r>c���tj�\|_|_|jj	d�|jj	d�|xj
dz
c_y)NFr)r�
socketpairr]r�setblockingr^rRs rrz%BaseProactorEventLoop._make_self_pipesN��#)�#4�#4�#6� ���T�[�������&�������&����a��r>c�t�	|�|j�|j|ury|jj|jd�}||_|j|j�y#tj$rYyttf$r�t$r}|jd||d��Yd}~yd}~wwxYw)Niz.Error on reading from the event loop self pipe)r`rar8)
r�rr�r�r]r��_loop_self_readingrr�r�r�r�re)r7r�rgs   rrcz(BaseProactorEventLoop._loop_self_readings���	9��}����
��(�(��1�����#�#�D�K�K��6�A�)*�D�%�
���� 7� 7�8���(�(�	���-�.�	���	��'�'�K� ��)�
�
��	�s"� A,�&A,�,B7�B7�B2�2B7c��|j}|�y	|jd�y#t$r(|jrt	j
dd��YyYywxYw)N�z3Fail to write a null byte into the self-pipe socketTr)rr�rcr<r
rd)r7�csocks  r�_write_to_selfz$BaseProactorEventLoop._write_to_self4sU�������=��	,��J�J�u����	,��{�{����0�&*�,��	,�s�#�,A�Ac	�P���������d��������fd�	��j��y)Nc
���	|�s|j�\}}�jrtjd�||���}���j	||�dd|i��
���n�j||d|i����j
�ry�jj�	�}|�j�	j�<|j��y#t$r�}�	j�dk7r9�jd|tj�	�d���	j!�n.�jrtjd	�	d�
�Yd}~yYd}~yYd}~yd}~wt"j$$r�	j!�YywxYw)Nz#%r got a new connection from %r: %rTr)rr;r<rrrrpzAccept failed on a socket)r`rarzAccept failed on socket %rr)r�r<r
rdrrr&r�rArrEr�rcrerrrYrr�)
r��connr�r9rgr8�protocol_factoryr7r<rrrrs
     ��������rr8z2BaseProactorEventLoop._start_serving.<locals>.loopKsw���#
*��=�!"����J�D�$��{�{����%J�%+�T�4�9�/�1�H�!�-��0�0� �(�J�D�#-�t�"4�V�2G�1E�	1�G��3�3� �(�#-�t�"4�V�4�E��>�>�#���N�N�)�)�$�/��78��$�$�T�[�[�]�3��#�#�D�)���

6��;�;�=�B�&��/�/�#>�%(�"(�"8�"8��">�1��
�J�J�L��[�[��L�L�!=�!%��6�6�!�!���,�,�
��
�
��
�s%�BC�	C�	F�A0E�&F�FrO)r2)	r7rkrrr<�backlogrrr8s	````` ``@r�_start_servingz$BaseProactorEventLoop._start_servingFs���
$	*�$	*�L	
���t�r>c��yrOr�)r7�
event_lists  r�_process_eventsz%BaseProactorEventLoop._process_eventsss��r>c��|jj�D]}|j��|jj�yrO)r�valuesrX�clear)r7�futures  rr'z*BaseProactorEventLoop._stop_accept_futuresws6���*�*�1�1�3�F��M�M�O�4����"�"�$r>c���|jj|j�d�}|r|j�|jj|�|j
�yrO)r�poprErXr��
_stop_servingrY)r7rrts   rrwz#BaseProactorEventLoop._stop_serving|sG���%�%�)�)�$�+�+�-��>����M�M�O����$�$�T�*��
�
�r>rxrOr�)r)NN�dNN)rCryrzr$rrrrr!r#rYr+r/r2r6r8r:r?rBrVr[r(rrcrgrmrpr'rwr}r~s@rrrvs����7�=A�26�7�9=�
+� �$��t�"&�!%�
+� CG�9�
BF�*.�K�
@D�(,�O�AE�)-�J��(2�9�<�E�5�C�;�
1�"�:
(� � �9�8,�&>A�-1�,0�+�Z
�%�
r>r)#�__all__rErHrr{r	rr��rrrrr	r
rr�logr
r�_FlowControlMixin�
BaseTransportr!�
ReadTransportr��WriteTransportr�r��DatagramTransportr��	Transportr�r��
BaseEventLooprr�r>r�<module>r�s���#��	�	�
��
������������0�$D��!=�!=�!+�!9�!9�D�NP2�!;�!+�!9�!9�P2�fk"�&@�&0�&?�&?�k"�\�"A��,A=�!;�!+�!=�!=�A=�H	"�#=�#B�#-�#7�#7�	"�0�9�>�)�3�3�0�4K�K�5�5�Kr>

?>