AlkantarClanX12

Your IP : 18.221.238.204


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

�

c��f����dZdZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl	m
Z
dd	l	mZdd
l	mZddl	mZddl	mZdd
lmZd�ZGd�dejej��ZGd�deej��ZGd�deej��ZGd�de��ZGd�deej��ZGd�deeej��Z Gd�deeej��Z!Gd�de
j"��Z#dS)z�Event loop using a proactor and related classes.

A proactor is a "notify-on-completion" multiplexer.  Currently a
proactor is only implemented on Windows with IOCP.
)�BaseProactorEventLoop�N�)�base_events)�	constants)�futures)�
exceptions)�	protocols)�sslproto)�
transports)�trsock)�loggerc��tj|��|jd<	|���|jd<nE#tj$r3|j���rtj	d|d���YnwxYwd|jvr?	|�
��|jd<dS#tj$rd|jd<YdSwxYwdS)N�socket�socknamezgetsockname() failed on %rT��exc_info�peername)r�TransportSocket�_extra�getsocknamer�error�_loop�	get_debugr
�warning�getpeername)�	transport�socks  �>/opt/alt/python311/lib64/python3.11/asyncio/proactor_events.py�_set_socket_extrars	��!'�!7��!=�!=�I��X��C�'+�'7�'7�'9�'9�	���$�$���<�C�C�C��?�$�$�&�&�	C��N�,�d�T�
C�
C�
C�
C���C����
��)�)�)�	0�+/�+;�+;�+=�+=�I��Z�(�(�(���|�	0�	0�	0�+/�I��Z�(�(�(�(�	0����*�)s!�;�?A=�<A=�
B(�(C�Cc�z��eZdZdZ		d�fd�	Zd�Zd�Zd�Zd�Zd�Z	d	�Z
ejfd
�Z
dd�Zd
�Zd�Zd�Z�xZS)�_ProactorBasePipeTransportz*Base class for pipe and socket transports.Nc�
��t���||��|�|��||_|�|��||_d|_d|_d|_d|_	d|_
d|_d|_d|_
|j�|j���|j�|jj|��|�(|j�t&j|d��dSdS)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� � �"�"�"��
���T�^�;�T�B�B�B����J� � ��!E�!'��
/�
/�
/�
/�
/���c�t�|jjg}|j�|�d��n|jr|�d��|j�/|�d|j�������|j�|�d|j����|j�|�d|j����|jr*|�dt|j������|j
r|�d��d�d	�|����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�3�d�j�/�/�1�1�3�3�4�4�4��>�%��K�K�2���2�2�3�3�3��?�&��K�K�4���4�4�5�5�5��<�	>��K�K�<��T�\�):�):�<�<�=�=�=���	'��K�K�
�&�&�&��}�}�S�X�X�d�^�^�,�,�,r>c��||jd<dS)N�pipe)r�r7rs  rr%z%_ProactorBasePipeTransport._set_extra[s��"���F���r>c��||_dS�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���|jrdSd|_|xjdz
c_|js'|j� |j�|jd��|j�"|j���d|_dSdS)NTr)	r.r-r)r+rr2�_call_connection_lostr*�cancelrRs r�closez _ProactorBasePipeTransport.closegs����=�	��F���
����1�����|�	C��� 7��J� � ��!;�T�B�B�B��>�%��N�!�!�#�#�#�!�D�N�N�N�&�%r>c�v�|j�1|d|��t|���|j���dSdS)Nzunclosed transport )�source)r&�ResourceWarningrY)r7�_warns  r�__del__z"_ProactorBasePipeTransport.__del__rsL���:�!��E�0��0�0�/�$�O�O�O�O��J��������"�!r>�Fatal error on pipe transportc�<�	t|t��r2|j���rt	jd||d���n$|j�||||jd���|�|��dS#|�|��wxYw)Nz%r: %sTr)�message�	exceptionrr9)	�
isinstance�OSErrorrrr
�debug�call_exception_handlerr3�_force_close)r7�excras   r�_fatal_errorz'_ProactorBasePipeTransport._fatal_errorws���	#��#�w�'�'�	
��:�'�'�)�)�I��L��4��4�H�H�H�H���
�1�1�&�!$�!%� $��	3�3����
���c�"�"�"�"�"��D���c�"�"�"�"���s�A+B�Bc��|j�P|j���s7|�|j�d��n|j�|��|jr	|jrdSd|_|xjdz
c_|jr |j���d|_|j	r |j	���d|_	d|_
d|_|j�
|j|��dS)NTrr)�
_empty_waiter�done�
set_result�
set_exceptionr.r/r-r+rXr*r,r)rr2rW)r7rhs  rrgz'_ProactorBasePipeTransport._force_close�s�����)�$�2D�2I�2I�2K�2K�)��{��"�-�-�d�3�3�3�3��"�0�0��5�5�5��=�	�T�9�	��F���
����1�����?�	#��O�"�"�$�$�$�"�D�O��>�	"��N�!�!�#�#�#�!�D�N��������
���T�7��=�=�=�=�=r>c���|jrdS	|j�|��t|jd��rA|j���dkr$|j�tj��|j�	��d|_|j
}|�|���d|_
d|_dS#t|jd��rA|j���dkr$|j�tj��|j�	��d|_|j
}|�|���d|_
d|_wxYw)N�shutdown���T)r/r3�connection_lost�hasattrr&rErpr�	SHUT_RDWRrYr(�_detach)r7rhr<s   rrWz0_ProactorBasePipeTransport._call_connection_lost�s\���'�	��F�	0��N�*�*�3�/�/�/��t�z�:�.�.�
6�4�:�3D�3D�3F�3F�"�3L�3L��
�#�#�F�$4�5�5�5��J�������D�J��\�F��!���� � � �#���+/�D�(�(�(���t�z�:�.�.�
6�4�:�3D�3D�3F�3F�"�3L�3L��
�#�#�F�$4�5�5�5��J�������D�J��\�F��!���� � � �#���+/�D�(�/�/�/�/s�C�B#E+c�P�|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)r_)rC�
__module__�__qualname__�__doc__r$rJr%r'rSrUrY�warnings�warnr^rirgrWrx�
__classcell__�r=s@rr!r!.s��������4�4�48�$(�/�/�/�/�/�/�.-�-�-�$#�#�#�"�"�"�������	"�	"�	"�%�M�����

#�
#�
#�
#�>�>�>�(0�0�0�(������r>r!c�N��eZdZdZ		d�fd�	Zd�Zd�Zd�Zd�Zd	�Z	dd
�Z
�xZS)
�_ProactorReadPipeTransportzTransport for read pipes.N�c����d|_d|_t���||||||��t	|��|_|j�|j��d|_dS)NrqTF)	�_pending_data_length�_pausedr#r$�	bytearray�_datarr2�
_loop_reading)	r7r8rr9r:r;r<�buffer_sizer=s	        �rr$z#_ProactorReadPipeTransport.__init__�sg���$&��!����
������t�X�v�u�f�E�E�E��{�+�+��
��
���T�/�0�0�0�����r>c�"�|jo|jSrO)r�r.rRs r�
is_readingz%_ProactorReadPipeTransport.is_reading�s���<��5��
�$5�5r>c��|js|jrdSd|_|j���rt	jd|��dSdS)NTz%r pauses reading)r.r�rrr
rerRs r�
pause_readingz(_ProactorReadPipeTransport.pause_reading�s\���=�	�D�L�	��F�����:���!�!�	4��L�,�d�3�3�3�3�3�	4�	4r>c�f�|js|jsdSd|_|j� |j�|jd��|j}d|_|dkr.|j�|j|jd|�|��|j�	��rtjd|��dSdS)NFrqz%r resumes reading)r.r�r*rr2r�r��_data_receivedr�rr
re)r7�lengths  r�resume_readingz)_ProactorReadPipeTransport.resume_reading�s����=�	���	��F�����>�!��J� � ��!3�T�:�:�:��*��$&��!��B�;�;�
�J� � ��!4�d�j��&��6I�6�R�R�R��:���!�!�	5��L�-�t�4�4�4�4�4�	5�	5r>c�F�|j���rtjd|��	|j���}n?#ttf$r�t$r!}|�	|d��Yd}~dSd}~wwxYw|s|�
��dSdS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.)rrr
rer3�eof_received�
SystemExit�KeyboardInterrupt�
BaseExceptionrirY)r7�	keep_openrhs   r�
_eof_receivedz(_ProactorReadPipeTransport._eof_received�s����:���!�!�	2��L�*�D�1�1�1�	���3�3�5�5�I�I���-�.�	�	�	���	�	�	�����H�
J�
J�
J��F�F�F�F�F�����	����
�	��J�J�L�L�L�L�L�	�	s�A
�
B�%B�Bc��|jr	||_dS|dkr|���dSt|jt
j��r\	tj|j|��dS#ttf$r�t$r!}|�|d��Yd}~dSd}~wwxYw|j�|��dS)Nrz3Fatal error: protocol.buffer_updated() call failed.)
r�r�r�rcr3r	�BufferedProtocol�_feed_data_to_buffered_protor�r�r�ri�
data_received)r7�datar�rhs    rr�z)_ProactorReadPipeTransport._data_received�s����<�	�)/�D�%��F��Q�;�;���� � � ��F��d�n�i�&@�A�A�	/�
��6�t�~�t�L�L�L�L�L��� 1�2�
�
�
�� �
�
�
��!�!�#�#1�2�2�2�����������	
����
�N�(�(��.�.�.�.�.s�
A)�)B%�B � B%c�(�d}d}	|�zd|_|���rK|���}|dkr!	|dkr|�||��dSdS|jd|�}n|���|jr!	|dkr|�||��dSdS|js/|jj	�
|j|j��|_|js|j�|j
��n�#t$rW}|js|�|d��n/|j���rt#jdd���Yd}~nod}~wt&$r}|�|��Yd}~nHd}~wt*$r }|�|d��Yd}~n d}~wt,j$r|js�YnwxYw|dkr|�||��dSdS#|dkr|�||��wwxYw)Nrqrz"Fatal read error on pipe transportz*Read error on pipe transport while closingTr)r*rl�resultr�r�rXr.r�r�	_proactor�	recv_intor&�add_done_callbackr��ConnectionAbortedErrorrirr
re�ConnectionResetErrorrgrdr�CancelledError)r7�futr�r�rhs     rr�z(_ProactorReadPipeTransport._loop_readings�������-	2���"&����8�8�:�:�
!� �Z�Z�\�\�F���{�{��D��{�{��#�#�D�&�1�1�1�1�1��{�A �:�g�v�g�.�D�D��J�J�L�L�L��}�
��2��{�{��#�#�D�&�1�1�1�1�1��{�)�<�
X�!%��!5�!?�!?��
�D�J�!W�!W����<�
E���0�0��1C�D�D�D���&�	,�	,�	,��=�
,��!�!�#�'K�L�L�L�L���%�%�'�'�
,���I�&*�,�,�,�,����������#�	#�	#�	#����c�"�"�"�"�"�"�"�"������	I�	I�	I����c�#G�H�H�H�H�H�H�H�H������(�	�	�	��=�
��
�
�	������{�{��#�#�D�&�1�1�1�1�1��{��v��{�{��#�#�D�&�1�1�1�1����sl�7D�+D�*6D� 'G2�
G�A
E#�G2�#
G�0F
�G2�

G�F2�-G2�2G�G2�G�G2�2H)NNNr�rO)rCrzr{r|r$r�r�r�r�r�r�rr�s@rr�r��s��������#�#�48�6;�������6�6�6�4�4�4�&5�5�5�$��� /�/�/�202�02�02�02�02�02�02�02r>r�c�R��eZdZdZdZ�fd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zd�Z�xZ
S)
�_ProactorBaseWritePipeTransportzTransport for write pipes.Tc�H��t��j|i|��d|_dSrO)r#r$rk�r7�args�kwr=s   �rr$z(_ProactorBaseWritePipeTransport.__init__Ms-��������$�%�"�%�%�%�!����r>c��t|tttf��s$t	dt|��j�����|jrtd���|j	�td���|sdS|j
r;|j
tjkrtjd��|xj
dz
c_
dS|j�%|�t|�����dS|js*t|��|_|���dS|j�|��|���dS)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�)rc�bytesr��
memoryview�	TypeError�typerCr0�RuntimeErrorrkr-r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr
rr+�
_loop_writingr)�_maybe_pause_protocol�extend)r7r�s  r�writez%_ProactorBaseWritePipeTransport.writeQsW���$��	�:� >�?�?�	.��-��D�z�z�*�-�-�.�.�
.���	=��;�<�<�<���)��I�J�J�J��	��F��?�	���)�"M�M�M���@�A�A�A��O�O�q� �O�O��F��?�"�
���E�$�K�K��0�0�0�0�0���	)�$�T�?�?�D�L��&�&�(�(�(�(�(�
�L����%�%�%��&�&�(�(�(�(�(r>Nc��	|�|j�	|jrdSd|_d|_|r|���|�|j}d|_|sg|jr |j�|jd��|jr$|j	�
tj��|�
��n�|jj�|j	|��|_|j���sHt#|��|_|j�|j��|���n|j�|j��|j�#|j�|j�d��dSdSdS#t.$r }|�|��Yd}~dSd}~wt2$r!}|�|d��Yd}~dSd}~wwxYw)Nrz#Fatal write error on pipe transport)r+r.r,r�r)rr2rWr0r&rpr�SHUT_WR�_maybe_resume_protocolr��sendrlrFr�r�r�rkrmr�rgrdri)r7�fr�rhs    rr�z-_ProactorBaseWritePipeTransport._loop_writingws��&	J��}���!8�T�]�!8���"�D�O�"#�D���
����
�
�
��|��|��#����
J��=�K��J�(�(��)C�T�J�J�J��$�8��J�'�'���7�7�7��+�+�-�-�-�-�"&�*�"6�";�";�D�J��"M�"M�����+�+�-�-�J�*-�d�)�)�D�'��O�5�5�d�6H�I�I�I��.�.�0�0�0�0��O�5�5�d�6H�I�I�I��!�-�$�/�2I��"�-�-�d�3�3�3�3�3�.�-�2I�2I��#�	#�	#�	#����c�"�"�"�"�"�"�"�"�"������	J�	J�	J����c�#H�I�I�I�I�I�I�I�I�I�����	J���s)�F	�E/F	�	
G�F.�.
G�;G�Gc��dS�NT�rRs r�
can_write_eofz-_ProactorBaseWritePipeTransport.can_write_eof�����tr>c�.�|���dSrO)rYrRs r�	write_eofz)_ProactorBaseWritePipeTransport.write_eof�s���
�
�����r>c�0�|�d��dSrO�rgrRs r�abortz%_ProactorBaseWritePipeTransport.abort�������$�����r>c��|j�td���|j���|_|j�|j�d��|jS)NzEmpty waiter is already set)rkr�r�
create_futurer+rmrRs r�_make_empty_waiterz2_ProactorBaseWritePipeTransport._make_empty_waiter�sX����)��<�=�=�=�!�Z�5�5�7�7����?�"���)�)�$�/�/�/��!�!r>c��d|_dSrO)rkrRs r�_reset_empty_waiterz3_ProactorBaseWritePipeTransport._reset_empty_waiter�s��!����r>�NN)rCrzr{r|�_start_tls_compatibler$r�r�r�r�r�r�r�rr�s@rr�r�Gs��������$�$� ��"�"�"�"�"�$)�$)�$)�L'J�'J�'J�'J�R������ � � �"�"�"�"�"�"�"�"�"�"r>r�c�$��eZdZ�fd�Zd�Z�xZS)�_ProactorWritePipeTransportc����t��j|i|��|jj�|jd��|_|j�|j��dS)N�)	r#r$rr��recvr&r*r��_pipe_closedr�s   �rr$z$_ProactorWritePipeTransport.__init__�s\��������$�%�"�%�%�%���-�2�2�4�:�r�B�B�����(�(��):�;�;�;�;�;r>c���|���rdS|jrdSd|_|j�#|�t����dS|���dSrO)�	cancelledr.r*r+rg�BrokenPipeErrorrY)r7r�s  rr�z(_ProactorWritePipeTransport._pipe_closed�sf���=�=�?�?�	��F��=�	��F�����?�&����o�/�/�0�0�0�0�0��J�J�L�L�L�L�Lr>)rCrzr{r$r�rr�s@rr�r��sG�������<�<�<�<�<�

�
�
�
�
�
�
r>r�c�R��eZdZdZ		d
�fd�	Zd�Zd�Zd�Zdd�Zdd�Z	dd	�Z
�xZS)�_ProactorDatagramTransportiNc����||_d|_d|_t���|||||���tj��|_|j�	|j
��dS)Nr)r:r;)�_addressrk�_buffer_sizer#r$�collections�dequer)rr2r�)r7r8rr9�addressr:r;r=s       �rr$z#_ProactorDatagramTransport.__init__�sp�����
�!������	������t�X�f�E��J�J�J�#�(�*�*����
���T�/�0�0�0�0�0r>c�&�t||��dSrO�rrMs  rr%z%_ProactorDatagramTransport._set_extra�����$��%�%�%�%�%r>c��|jSrO)r�rRs rrxz0_ProactorDatagramTransport.get_write_buffer_size�s��� � r>c�0�|�d��dSrOr�rRs rr�z _ProactorDatagramTransport.abort�r�r>c�Z�t|tttf��st	dt|�����|sdS|j�"|d|jfvrtd|j�����|jrB|jr;|jtj
krtjd��|xjdz
c_dS|j
�t|��|f��|xjt!|��z
c_|j�|���|���dS)Nz,data argument must be bytes-like object (%r)z!Invalid address: must be None or z!socket.sendto() raised exception.r)rcr�r�r�r�r�r��
ValueErrorr-rr�r
rr)rDr�rFr+r�r�)r7r��addrs   r�sendtoz!_ProactorDatagramTransport.sendto�s?���$��	�:� >�?�?�	(��J� ��J�J�(�(�
(��	��F��=�$��d�D�M�5J�)J�)J��C�D�M�C�C�E�E�
E��?�	�t�}�	���)�"M�M�M���B�C�C�C��O�O�q� �O�O��F�	
����U�4�[�[�$�/�0�0�0����S��Y�Y�&����?�"���� � � �	
�"�"�$�$�$�$�$r>c��	|jrdSd|_|r|���|jr|jr0|jr)|jr |j�|jd��dS|j�	��\}}|xj
t|��zc_
|j�+|jj�
|j|��|_n,|jj�|j||���|_|j�|j��|���dS#t&$r%}|j�|��Yd}~dSd}~wt,$r!}|�|d��Yd}~dSd}~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�rdr3�error_received�	Exceptionri)r7r�r�r�rhs     rr�z(_ProactorDatagramTransport._loop_writings���	*���
���#�D�O��
��
�
�����<�
�D�O�
��
�
��=�K��J�(�(��)C�T�J�J�J�����-�-�/�/�J�D�$�����T���*����}�(�"&�*�"6�";�";�D�J�<@�#B�#B����#'�*�"6�"=�"=�d�j�>B�CG�#>�#I�#I���
�O�-�-�d�.@�A�A�A��'�'�)�)�)�)�)��
�	/�	/�	/��N�)�)�#�.�.�.�.�.�.�.�.�.������	N�	N�	N����c�#L�M�M�M�M�M�M�M�M�M�����	N���s0�D2�AD2�&BD2�2
F
�<E�
F
�)F�F
c��d}	|jr"	|r|j�||��dSdSd|_|�U|���}|jr$d}	|r|j�||��dSdS|j�
||j}}n|\}}|jr"	|r|j�||��dSdS|j�0|jj�	|j
|j��|_n/|jj�|j
|j��|_|j�|j�
|j��nI#t$r$}|j�|��Yd}~n d}~wt"j$r|js�YnwxYw|r|j�||��dSdS#|r|j�||��wwxYwrO)r-r3�datagram_receivedr*r�r.r�rr�r�r&�max_size�recvfromr�r�rdr�rr�)r7r�r�r��resrhs      rr�z(_ProactorDatagramTransport._loop_reading#sY����'	=���
��H�
=���0�0��t�<�<�<�<�<�
=�
=�?"�D�N����j�j�l�l���=���D��0�
=���0�0��t�<�<�<�<�<�
=�
=�-�=�,�!$�d�m�$�D�D�!$�J�D�$���
�� �
=���0�0��t�<�<�<�<�<�
=�
=��}�(�!%��!5�!:�!:�4�:�;?�=�"J�"J����"&��!5�!>�!>�t�z�?C�}�"N�"N����~�)���0�0��1C�D�D�D����	/�	/�	/��N�)�)�#�.�.�.�.�.�.�.�.������(�	�	�	��=�
��
�
�	�����
=���0�0��t�<�<�<�<�<�
=�
=��t�
=���0�0��t�<�<�<�<�
=���sM�E�&E�5E�4A&E�'F+�
F�E*�%F+�*F�F+�F�F+�+ GryrO)rCrzr{r�r$r%rxr�r�r�r�rr�s@rr�r��s���������H�59�$(�1�1�1�1�1�1�&�&�&�!�!�!� � � �%�%�%�%�: *� *� *� *�D)=�)=�)=�)=�)=�)=�)=�)=r>r�c��eZdZdZd�Zd�ZdS)�_ProactorDuplexPipeTransportzTransport for duplex pipes.c��dS)NFr�rRs rr�z*_ProactorDuplexPipeTransport.can_write_eofTs���ur>c��t�rO)�NotImplementedErrorrRs rr�z&_ProactorDuplexPipeTransport.write_eofWs��!�!r>N)rCrzr{r|r�r�r�r>rr�r�Os:������&�%����"�"�"�"�"r>r�c�R��eZdZdZejjZ		d�fd�	Zd�Z	d�Z
d�Z�xZS)�_ProactorSocketTransportz Transport for connected sockets.Nc�|��t���||||||��tj|��dSrO)r#r$r�_set_nodelayr6s       �rr$z!_ProactorSocketTransport.__init__bs<���
������t�X�v�u�f�E�E�E�� ��&�&�&�&�&r>c�&�t||��dSrOr�rMs  rr%z#_ProactorSocketTransport._set_extragr�r>c��dSr�r�rRs rr�z&_ProactorSocketTransport.can_write_eofjr�r>c��|js|jrdSd|_|j�&|j�t
j��dSdSr�)r.r0r+r&rprr�rRs rr�z"_ProactorSocketTransport.write_eofmsQ���=�	�D�-�	��F� ����?�"��J�����/�/�/�/�/�#�"r>ry)
rCrzr{r|r�
_SendfileMode�
TRY_NATIVE�_sendfile_compatibler$r%r�r�rr�s@rr�r�[s��������+�*�$�2�=��48�$(�'�'�'�'�'�'�
&�&�&����0�0�0�0�0�0�0r>r�c����eZdZ�fd�Z		d d�Z	d!ddddddd�d�Z	d d�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�Zd!d�Zd�Z			d$d�Zd�Zd�Zd�Z�xZS)%rc���t�����tjd|jj��||_||_d|_i|_	|�
|��|���tj
��tj��ur-tj|j�����dSdS)NzUsing proactor: %s)r#r$r
rer=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__ws����
����������)�8�+=�+F�G�G�G�!���!���$(��!�!������$�����������#�%�%��)>�)@�)@�@�@�� ���!3�!3�!5�!5�6�6�6�6�6�A�@r>Nc�*�t||||||��SrO)r�)r7rr9r:r;r<s      r�_make_socket_transportz,BaseProactorEventLoop._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)rr�r;r<)r
�SSLProtocolr��_app_transport)r7�rawsockr9�
sslcontextr:rrr;r<rr�ssl_protocols            r�_make_ssl_transportz)BaseProactorEventLoop._make_ssl_transport�s\�� �+��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�9�	9r>c�(�t|||||��SrO)r��r7rr9r:r;s     r�_make_duplex_pipe_transportz1BaseProactorEventLoop._make_duplex_pipe_transport�s"��+�D�,0�(�F�E�K�K�	Kr>c�(�t|||||��SrO)r�r!s     r�_make_read_pipe_transportz/BaseProactorEventLoop._make_read_pipe_transport�s��)�$��h���N�N�Nr>c�(�t|||||��SrO)r�r!s     r�_make_write_pipe_transportz0BaseProactorEventLoop._make_write_pipe_transport�s$��+�4�+/��6�5�J�J�	Jr>c����|���rtd���|���rdStj��tj��urt
jd��|���|�	��|j
���d|_
d|_t�����dS)Nz!Cannot close a running event looprq)�
is_runningr��	is_closedr	r
rrr
�_stop_accept_futures�_close_self_piper�rYrr#)r7r=s �rrYzBaseProactorEventLoop.close�s�����?�?���	D��B�C�C�C��>�>���	��F��#�%�%��)>�)@�)@�@�@�� ��$�$�$�	
�!�!�#�#�#��������������������	���
�
�����r>c��HK�|j�||���d{V��SrO)r�r�)r7r�ns   r�	sock_recvzBaseProactorEventLoop.sock_recv�s0�����^�(�(��q�1�1�1�1�1�1�1�1�1r>c��HK�|j�||���d{V��SrO)r�r�)r7r�bufs   r�sock_recv_intoz$BaseProactorEventLoop.sock_recv_into�s0�����^�-�-�d�C�8�8�8�8�8�8�8�8�8r>c��HK�|j�||���d{V��SrO)r�r�)r7r�bufsizes   r�
sock_recvfromz#BaseProactorEventLoop.sock_recvfrom�s0�����^�,�,�T�7�;�;�;�;�;�;�;�;�;r>rc��lK�|st|��}|j�|||���d{V��SrO)rFr��
recvfrom_into)r7rr0�nbytess    r�sock_recvfrom_intoz(BaseProactorEventLoop.sock_recvfrom_into�sE�����	���X�X�F��^�1�1�$��V�D�D�D�D�D�D�D�D�Dr>c��HK�|j�||���d{V��SrO)r�r�)r7rr�s   r�sock_sendallz"BaseProactorEventLoop.sock_sendall�s0�����^�(�(��t�4�4�4�4�4�4�4�4�4r>c��LK�|j�||d|���d{V��S)Nr)r�r�)r7rr�r�s    r�sock_sendtoz!BaseProactorEventLoop.sock_sendto�s4�����^�*�*�4��q�'�B�B�B�B�B�B�B�B�Br>c��HK�|j�||���d{V��SrO)r��connect)r7rr�s   r�sock_connectz"BaseProactorEventLoop.sock_connect�s0�����^�+�+�D�'�:�:�:�:�:�:�:�:�:r>c��FK�|j�|���d{V��SrO)r��acceptrMs  r�sock_acceptz!BaseProactorEventLoop.sock_accept�s.�����^�*�*�4�0�0�0�0�0�0�0�0�0r>c��K�	|���}n2#ttjf$r}t	jd���d}~wwxYw	t
j|��j}n"#t$rt	jd���wxYw|r|n|}|sdSt|d��}|rt||z|��n|}	t||��}d}
		t|	|z
|��}|dkr|
|
dkr|�|��SS|j�
||||���d{V��||z
}|
|z
}
�e#|
dkr|�|��wwxYw)Nznot a regular filerl��)rE�AttributeError�io�UnsupportedOperationr�SendfileNotAvailableError�os�fstat�st_sizerd�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�F���� 7�8�	M�	M�	M��6�7K�L�L�L�����	M����	M��H�V�$�$�,�E�E���	M�	M�	M��6�7K�L�L�L�	M����"�-�E�E��	��	��1��	�;�/�/�	�05�@�#�f�u�n�e�,�,�,�5���V�U�#�#���
�
	"�
(���&� 0�)�<�<�	���>�>�%�
�A�~�~��	�	�&�!�!�!�!��	�n�-�-�d�D�&�)�L�L�L�L�L�L�L�L�L��)�#���i�'�
�

(���A�~�~��	�	�&�!�!�!�!����s2��A�A�A�A&�&B�D2�.D2�2Ec��K�|���}|���|����d{V��	|�|j|||d����d{V��	|���|r|���SS#|���|r|���wwxYw)NF)�fallback)r�r�r��
sock_sendfiler&r�r�)r7�transprNrOrPr�s      r�_sendfile_nativez&BaseProactorEventLoop._sendfile_native�s
�����*�*�,�,���������'�'�)�)�)�)�)�)�)�)�)�	(��+�+�F�L�$���5:�,�<�<�<�<�<�<�<�<�
<�
�&�&�(�(�(��
(��%�%�'�'�'�'�
(��
�&�&�(�(�(��
(��%�%�'�'�'�'�
(���s�$B�-Cc���|j� |j���d|_|j���d|_|j���d|_|xjdzc_dS)Nr)rrX�_ssockrYr�
_internal_fdsrRs rr+z&BaseProactorEventLoop._close_self_pipesx���$�0��%�,�,�.�.�.�(,�D�%������������������������a�����r>c���tj��\|_|_|j�d��|j�d��|xjdz
c_dS)NFr)r�
socketpairr]r�setblockingr^rRs rrz%BaseProactorEventLoop._make_self_pipes_��#)�#4�#6�#6� ���T�[������&�&�&������&�&�&����a�����r>c�r�	|�|���|j|urdS|j�|jd��}||_|�|j��dS#tj$rYdSttf$r�t$r$}|�d||d���Yd}~dSd}~wwxYw)Niz.Error on reading from the event loop self pipe)rarbr8)
r�rr�r�r]r��_loop_self_readingrr�r�r�r�rf)r7r�rhs   rrcz(BaseProactorEventLoop._loop_self_readings��	9��}����
�
�
��(��1�1�����#�#�D�K��6�6�A�)*�D�%�
���� 7�8�8�8�8�8���(�	�	�	��F�F��-�.�	�	�	���	�	�	��'�'�K� ��)�)�
�
�
�
�
�
�
�
�
�����	���s"�A&� A&�&B6�8B6�B1�1B6c��|j}|�dS	|�d��dS#t$r$|jrt	jdd���YdSYdSwxYw)N�z3Fail to write a null byte into the self-pipe socketTr)rr�rd�_debugr
re)r7�csocks  r�_write_to_selfz$BaseProactorEventLoop._write_to_self1s�������=��F�	,��J�J�u��������	,�	,�	,��{�
,���0�&*�,�,�,�,�,�,�,�
,�
,�
,�	,���s�$�'A�A�dc	�Z���������d��������fd�	������dS)Nc
�F��	|�||���\}}�jrtjd�||�����}�� ��||�dd|i��
����n��||d|i��������rdS�j��	��}|�j	�	�
��<|����dS#t$r�}�	�
��dkr@��
d|tj�	��d����	���n*�jrtjd	�	d�
��Yd}~dSYd}~dSYd}~dSd}~wt"j$r�	���YdSwxYw)Nz#%r got a new connection from %r: %rTr)rr;r<rrrrqzAccept failed on a socket)rarbrzAccept failed on socket %rr)r�rfr
rerrr)r�rArrEr�rdrfrrrYrr�)
r��connr�r9rhr8�protocol_factoryr7r<rrrrs
     ��������rr8z2BaseProactorEventLoop._start_serving.<locals>.loopHsD���#
*��=�!"�����J�D�$��{�9���%J�%+�T�4�9�9�9�/�/�1�1�H�!�-��0�0� �(�J�D�#-�t�"4�V�2G�1E�	1�G�G�G�G��3�3� �(�#-�t�"4�V�4�E�E�E��>�>�#�#���F��N�)�)�$�/�/��78��$�T�[�[�]�]�3��#�#�D�)�)�)�)�)���

6�

6�

6��;�;�=�=�B�&�&��/�/�#>�%(�"(�"8��">�">�1�1����
�J�J�L�L�L�L��[�6��L�!=�!%��6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�!�L�L�L�L�L������,�
�
�
��
�
�������
���s%�BC$�C$�$
F �.A6E6�6&F �F rO)r2)	r7rmrrr<�backlogrrr8s	````` ``@r�_start_servingz$BaseProactorEventLoop._start_servingCsf����������
$	*�$	*�$	*�$	*�$	*�$	*�$	*�$	*�$	*�$	*�$	*�$	*�$	*�L	
���t�����r>c��dSrOr�)r7�
event_lists  r�_process_eventsz%BaseProactorEventLoop._process_eventsps���r>c��|j���D]}|����|j���dSrO)r�valuesrX�clear)r7�futures  rr*z*BaseProactorEventLoop._stop_accept_futurestsJ���*�1�1�3�3�	�	�F��M�M�O�O�O�O���"�"�$�$�$�$�$r>c���|j�|���d��}|r|���|j�|��|���dSrO)r�poprErXr��
_stop_servingrY)r7rrvs   rryz#BaseProactorEventLoop._stop_servingys^���%�)�)�$�+�+�-�-��>�>���	��M�M�O�O�O���$�$�T�*�*�*��
�
�����r>ryrOr�)r)NNriNN)rCrzr{r$rrrr"r$r&rYr.r1r4r8r:r<r?rBrVr[r+rrcrhrorrr*ryrr�s@rrrusS�������7�7�7�7�7�=A�26�7�7�7�7�9=�
+� �$��t�"&�!%�
+�
+�
+�
+�
+� CG�9�9�9�9�
BF�*.�K�K�K�K�
@D�(,�O�O�O�O�AE�)-�J�J�J�J������(2�2�2�9�9�9�<�<�<�E�E�E�E�5�5�5�C�C�C�;�;�;�1�1�1�"�"�"�:
(�
(�
(� � � � � � �9�9�9�9�8,�,�,�&>A�-1�,0�+�+�+�+�Z
�
�
�%�%�%�
������r>r)$r|�__all__rErHrr}rr	r��rrrrr	r
rr�logr
r�_FlowControlMixin�
BaseTransportr!�
ReadTransportr��WriteTransportr�r��DatagramTransportr��	Transportr�r��
BaseEventLooprr�r>r�<module>r�s�����#��	�	�	�	�	�	�	�	�
�
�
�
�����
�
�
�
���������������������������������������������������������������0�0�0�$D�D�D�D�D��!=�!+�!9�D�D�D�NO2�O2�O2�O2�O2�!;�!+�!9�O2�O2�O2�dk"�k"�k"�k"�k"�&@�&0�&?�k"�k"�k"�\�����"A����,A=�A=�A=�A=�A=�!;�!+�!=�A=�A=�A=�H	"�	"�	"�	"�	"�#=�#B�#-�#7�	"�	"�	"�0�0�0�0�0�9�>�)�3�0�0�0�4I�I�I�I�I�K�5�I�I�I�I�Ir>