AlkantarClanX12

Your IP : 3.129.216.15


Current Path : /opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/connection.cpython-312.opt-1.pyc

�

�Q�f�����gd�ZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddlm
Z
mZddlmZej"Z	ddlZddlmZmZmZmZd	Zd
Ze	j8�ZdZdgZe ed�rdZedgz
Zej2dk(rd
Zed
gz
Zefd�Z!d�Z"d�Z#d�Z$d�Z%Gd�d�Z&erGd�de&�Z'Gd�de&�Z(Gd�de)�Z*dEd�Z+ej2dk7rdFd�Z,ndFd�Z,Gd�de)�Z-d �Z.ej2dk(rGd!�d"e)�Z/d#�Z0d$Z1d%Z2d&Z3d'Z4e5hd(��Z6e7d)�e6D��Z8d*Z9d+Z:e9e:fZ;d,e<d-e=e<ffd.�Z>d/�Z?d0�Z@dGd1e<fd2�ZAd1e<fd3�ZBGd4�d5e)�ZCd6�ZDd7�ZEGd8�d9e*�ZFd:�ZGej2dk(r d;�ZHej�ej�hZKdHd<�ZLn*ddlMZMe eMd=�r
eMj�ZOneMj�ZOdHd>�ZLej2dk(r3d?�ZQd@�ZRej�e(eQ�dA�ZTdB�ZUej�e'eT�ydC�ZQdD�ZRej�e(eQ�y#e$rej2dk(r�dZY���wxYw)I)�Client�Listener�Pipe�wait�N�)�util)�AuthenticationError�BufferTooShort)�	reduction)�
WAIT_OBJECT_0�WAIT_ABANDONED_0�WAIT_TIMEOUT�INFINITE�win32i g4@�AF_INET�AF_UNIX�AF_PIPEc�0�tj�|zS�N��time�	monotonic)�timeouts �A/opt/alt/python312/lib64/python3.12/multiprocessing/connection.py�
_init_timeoutr<s���>�>��g�%�%�c�0�tj�|kDSrr)�ts r�_check_timeoutr?s���>�>��a��rc��|dk(ry|dk(r)tjdtj���S|dk(r;tjdt	j
�t
t�fzd��Std	��)
z?
    Return an arbitrary free address for the given family
    r)�	localhostrrz	listener-)�prefix�dirrz\\.\pipe\pyc-%d-%d-�zunrecognized family)	�tempfile�mktempr�get_temp_dir�os�getpid�next�
_mmap_counter�
ValueError��familys r�arbitrary_addressr/Fsy������	�9�	����k�t�7H�7H�7J�K�K�	�9�	����&<� "�	�	��T�-�-@�A�'B�GI�K�	K��.�/�/rc��tjdk7r|dk(rtd|z��tjdk(r%|dk(rtt|�std|z��yyy)zD
    Checks if the family is valid for the current environment.
    rrzFamily %s is not recognized.rN)�sys�platformr,�hasattr�socketr-s r�_validate_familyr5Tsc���|�|�w��6�Y�#6��7�&�@�A�A�
�|�|�w��6�Y�#6��v�v�&��;�f�D�E�E�'�$7�rc���t|�tk(ryt|�tur|jd�ryt|�tust	j
|�ryt
d|z��)z]
    Return the types of the address

    This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
    rz\\rrzaddress type of %r unrecognized)�type�tuple�str�
startswithr�is_abstract_socket_namespacer,)�addresss r�address_typer=`s\���G�}����	
�g��#�	�'�"4�"4�V�"<��	
�g��#�	��!B�!B�7�!K���:�W�D�E�Erc��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	e
d��Ze
d	��Ze
d
��Z
d�Zd�Zdd
�Zd�Zdd�Zdd�Zd�Zdd�Zd�Zd�Zy)�_ConnectionBaseNc��|j�}|dkrtd��|s
|std��||_||_||_y)Nrzinvalid handlez6at least one of `readable` and `writable` must be True)�	__index__r,�_handle�	_readable�	_writable)�self�handle�readable�writables    r�__init__z_ConnectionBase.__init__vsO���!�!�#���A�:��-�.�.����H�J�
J����!���!��rc�>�|j�|j�yyr�rB�_close�rEs r�__del__z_ConnectionBase.__del__�s���<�<�#��K�K�M�$rc�2�|j�td��y)N�handle is closed)rB�OSErrorrMs r�
_check_closedz_ConnectionBase._check_closed�s���<�<���,�-�-� rc�2�|jstd��y)Nzconnection is write-only)rCrQrMs r�_check_readablez_ConnectionBase._check_readable�s���~�~��4�5�5�rc�2�|jstd��y)Nzconnection is read-only)rDrQrMs r�_check_writablez_ConnectionBase._check_writable�s���~�~��3�4�4�rc�t�|jrd|_td��|j�td��)NFzbad message length)rDrC�closerQrMs r�_bad_message_lengthz#_ConnectionBase._bad_message_length�s5���>�>�"�D�N��*�+�+�
�J�J�L��*�+�+rc��|jduS)z True if the connection is closedN�rBrMs r�closedz_ConnectionBase.closed�s���|�|�t�#�#rc��|jS)z"True if the connection is readable)rCrMs rrGz_ConnectionBase.readable�����~�~�rc��|jS)z"True if the connection is writable)rDrMs rrHz_ConnectionBase.writable�r^rc�:�|j�|jS)z+File descriptor or handle of the connection)rRrBrMs r�filenoz_ConnectionBase.fileno�s�������|�|�rc�f�|j�	|j�d|_yy#d|_wxYw)zClose the connectionNrKrMs rrXz_ConnectionBase.close�s1���<�<�#�
$����
�#���	$�� $���s�'�	0c�v�|j�|j�t|�}|jdkDr|j	d�}|j
}|dkrt
d��||krt
d��|�||z
}n#|dkrt
d��||z|kDrt
d��|j||||z�y)	z,Send the bytes data from a bytes-like objectr�Brzoffset is negativezbuffer length < offsetNzsize is negativezbuffer length < offset + size)rRrV�
memoryview�itemsize�cast�nbytesr,�_send_bytes)rE�buf�offset�size�m�ns      r�
send_bytesz_ConnectionBase.send_bytes�s������������s�O���:�:��>����s��A�
�H�H���A�:��1�2�2��v�:��5�6�6��<��v�:�D�
�A�X��/�0�0�
�d�]�Q�
��<�=�=�����6�&�4�-�0�1rc��|j�|j�|jtj	|��y)zSend a (picklable) objectN)rRrVri�_ForkingPickler�dumps�rE�objs  r�sendz_ConnectionBase.send�s3��������������.�.�s�3�4rc���|j�|j�|�|dkrtd��|j|�}|�|j	�|j�S)z7
        Receive bytes data as a bytes object.
        rznegative maxlength)rRrTr,�_recv_bytesrY�getvalue)rE�	maxlengthrjs   r�
recv_bytesz_ConnectionBase.recv_bytes�sa��	
��������� �Y��]��1�2�2����y�)���;��$�$�&��|�|�~�rc���|j�|j�t|�5}|j}|t	|�z}|dkrtd��||kDrtd��|j
�}|j�}|||zkrt|j���|jd�|j|||z||z|z�|cddd�S#1swYyxYw)zq
        Receive bytes data into a writeable bytes-like object.
        Return the number of bytes read.
        rznegative offsetzoffset too largeN)rRrTrerf�lenr,rw�tellr
rx�seek�readinto)rErjrkrmrf�bytesize�resultrls        r�recv_bytes_intoz_ConnectionBase.recv_bytes_into�s���
	
��������
��_���z�z�H��#�a�&�(�H���z� �!2�3�3��(�"� �!3�4�4��%�%�'�F��;�;�=�D��&�4�-�'�$�V�_�_�%6�7�7��K�K��N��O�O�A�f��0�%��}��9�;�
<��!	�	�_�_�s�B+C!�!C*c��|j�|j�|j�}tj	|j��S)zReceive a (picklable) object)rRrTrwrq�loads�	getbuffer)rErjs  r�recvz_ConnectionBase.recv�s?������������� ���$�$�S�]�]�_�5�5rc�d�|j�|j�|j|�S)z/Whether there is any input available to be read)rRrT�_poll�rErs  r�pollz_ConnectionBase.poll�s)�����������z�z�'�"�"rc��|Sr�rMs r�	__enter__z_ConnectionBase.__enter__����rc�$�|j�yr�rX�rE�exc_type�	exc_value�exc_tbs    r�__exit__z_ConnectionBase.__exit__����
�
�r)TT)rNr)r)g)�__name__�
__module__�__qualname__rBrIrNrRrTrVrY�propertyr\rGrHrarXrorurzr�r�r�r�r�r�rrr?r?ss����G�	"��.�6�5�,��$��$����������
$�2�(5���26�#��rr?c�P�eZdZdZdZdZejfd�Zd�Z	d	d�Z
d�Zd�Zy)
�PipeConnectionz�
        Connection class based on a Windows named pipe.
        Overlapped I/O is used, so the handles must have been created
        with FILE_FLAG_OVERLAPPED.
        FNc�d�|j}|�|j�||j�yr)�_send_ov�cancelrB)rE�_CloseHandle�ovs   rrLzPipeConnection._closes%�����B��~��	�	������&rc��|j�td��tj|j|d��\}}||_	|tj
k(r&tj|jgdt�}d|_|jd�\}}|tjk(rttjd��y#|j��xYw#d|_|jd�\}}wxYw)Nz/concurrent send_bytes() calls are not supportedT��
overlappedFrP)r�r,�_winapi�	WriteFilerB�ERROR_IO_PENDING�WaitForMultipleObjects�eventrr��GetOverlappedResult�ERROR_OPERATION_ABORTEDrQ�errno�EPIPE)rErjr��err�waitres�nwrittens      rrizPipeConnection._send_bytess����}�}�(� �"5�6�6��'�'����c�d�K�G�B���D�M�

=��'�2�2�2�%�<�<����
�E�8�5�G�!%��
� "� 6� 6�t� <�
��#��g�5�5�5��e�k�k�+=�>�>�	6��

��	�	���� $��
� "� 6� 6�t� <�
��#�s�9C�C�C�C:c���|jrd|_tj�S|�dnt|d�}	t	j
|j|d��\}}	|tjk(r&t	j|jgdt�}|jd�\}}|dk(r5tj�}|j|j��|S|tjk(r|j!||�S	t+d��#|j��xYw#|jd�\}}|dk(r9tj�}|j|j��|ccYS|tjk(r|j!||�ccYSwxYw#t"$r)}|j$tj&k(rt(��d}~wwxYw)NF�Tr�rz.shouldn't get here; expected KeyboardInterrupt)�_got_empty_message�io�BytesIO�minr��ReadFilerBr�r�r�rr�r��writer��ERROR_MORE_DATA�_get_more_datarQ�winerror�ERROR_BROKEN_PIPE�EOFError�RuntimeError)	rE�maxsize�bsizer�r�r��nread�f�es	         rrwzPipeConnection._recv_bytes6s����&�&�*/��'��z�z�|�#�&���C���4E���%�.�.�t�|�|�U�;?�A�G�B��D��'�":�":�:�&-�&D�&D�!#���
�E�8�'=�G�&(�%;�%;�D�%A�
��s��!�8� "�
�
��A��G�G�B�L�L�N�3�#$�H� �G�$;�$;�;�#'�#6�#6�r�7�#C�C�<��O�P�P��!��	�	����%'�%;�%;�D�%A�
��s��!�8� "�
�
��A��G�G�B�L�L�N�3�#$�H� �G�$;�$;�;�#'�#6�#6�r�7�#C�C�<�����z�z�W�%>�%>�>�&����	�s[�%F-�9D�A
F-�&$F-�D*�*D-�-AF*�>F-�'F*�'F-�)F*�*F-�-	G�6$G�Gc��|js%tj|j�ddk7ryt	t|g|��S)NrT)r�r��
PeekNamedPiperB�boolrr�s  rr�zPipeConnection._pollVs>���'�'��-�-�d�l�l�;�A�>�!�C����d�V�W�-�.�.rc��|j�}tj�}|j|�t	j
|j�d}|�!t|�|z|kDr|j�t	j|j|d��\}}|jd�\}}|j|j��|S)NrTr�)r�r�r�r�r�r�rBr|rYr�r�)rEr�r�rjr��leftr��rbytess        rr�zPipeConnection._get_more_data\s����,�,�.�C��
�
��A�
�G�G�C�L��(�(����6�q�9�D��"�s�3�x�$���'@��(�(�*��&�&�t�|�|�T�d�K�G�B���0�0��6�K�F�C�
�G�G�B�L�L�N�#��Hrr)
r�r�r��__doc__r�r�r��CloseHandlerLrirwr�r�r�rrr�r�s8��	�
#����&-�&9�&9�	'�	(�4	Q�@	/�
	rr�c���eZdZdZer(ejfd�ZejZ	ejZn'ejfd�ZejZ	ejZe	fd�Zefd�Zd�Zd
d�Zd	�Zy)�
Connectionzo
    Connection class based on an arbitrary file descriptor (Unix only), or
    a socket handle (Windows).
    c�(�||j�yrr[�rErLs  rrLzConnection._closes����4�<�<� rc�(�||j�yrr[r�s  rrLzConnection._closexr�rc�b�t|�}	||j|�}||z}|dk(ry||d}�$�Nr)r|rB)rErjr��	remainingrns     r�_sendzConnection._send}sA����H�	���d�l�l�C�(�A���N�I��A�~���a�b�'�C�rc���tj�}|j}|}|dkDrK|||�}t|�}|dk(r||k(rt�td��|j
|�||z}|dkDr�K|S)Nrzgot end of file during message)r�r�rBr|r�rQr�)rErl�readrjrFr��chunkrns        r�_recvzConnection._recv�s|���j�j�l�������	��!�m����+�E��E�
�A��A�v���$�"�N�!�"B�C�C��I�I�e����N�I��!�m��
rc��t|�}|dkDr`tjdd�}tjd|�}|j|�|j|�|j|�ytjd|�}|dkDr#|j|�|j|�y|j||z�y)Ni����!i����!Qi@)r|�struct�packr�)rErjrn�
pre_header�headers     rrizConnection._send_bytes�s�����H���z�>����T�2�.�J��[�[��q�)�F��J�J�z�"��J�J�v���J�J�s�O��[�[��q�)�F��5�y��
�
�6�"��
�
�3���
�
�6�C�<�(rNc��|jd�}tjd|j��\}|dk(r7|jd�}tjd|j��\}|�||kDry|j|�S)N�r�r��r�)r�r��unpackrx)rEr�rjrls    rrwzConnection._recv_bytes�sq���j�j��m���
�
�d�C�L�L�N�3����2�:��*�*�Q�-�C��M�M�$�����7�E�D���4�'�>���z�z�$��rc�2�t|g|�}t|�Sr)rr�)rEr�rs   rr�zConnection._poll�s���$���!���A�w�rr)r�r�r�r�r��_multiprocessing�closesocketrLru�_writer��_readr(rXr�r�r�r�rirwr�r�rrr�r�lso���
� 0� <� <�	!�!�&�&�� �%�%�� "���	!���������%�� %�� )�. �rr�c�P�eZdZdZd
d�Zd�Zd�Zed��Zed��Z	d�Z
d	�Zy)rz�
    Returns a listener object.

    This is a wrapper for a bound socket which is 'listening' for
    connections, or for a Windows named pipe.
    Nc��|xs|xrt|�xst}|xst|�}t|�|dk(rt	||�|_nt
|||�|_|�t|t�std��||_
y)Nr�authkey should be a byte string)r=�default_familyr/r5�PipeListener�	_listener�SocketListener�
isinstance�bytes�	TypeError�_authkey)rEr<r.�backlog�authkeys     rrIzListener.__init__�s����#�G�=��W�(=�#�"�	��6�.�v�6���� ��Y��)�'�7�;�D�N�+�G�V�W�E�D�N���z�'�5�'A��=�>�>���
rc���|j�td��|jj�}|j�,t	||j�t||j�|S)zz
        Accept a connection on the bound socket or named pipe of `self`.

        Returns a `Connection` object.
        zlistener is closed)r�rQ�acceptr��deliver_challenge�answer_challenge)rE�cs  rr�zListener.accept�sW���>�>�!��.�/�/��N�N�!�!�#���=�=�$��a����/��Q��
�
�.��rc�P�|j}|�d|_|j�yy)zA
        Close the bound socket or named pipe of `self`.
        N)r�rX)rE�listeners  rrXzListener.close�s)���>�>����!�D�N��N�N�� rc�.�|jjSr)r��_addressrMs rr<zListener.address�s���~�~�&�&�&rc�.�|jjSr)r��_last_acceptedrMs r�
last_acceptedzListener.last_accepted�s���~�~�,�,�,rc��|Srr�rMs rr�zListener.__enter__�r�rc�$�|j�yrr�r�s    rr�zListener.__exit__�r�r)NNrN)r�r�r�r�rIr�rXr�r<rr�r�r�rrrr�sH��� � 
���'��'��-��-��rrc���|xst|�}t|�|dk(rt|�}nt|�}|�t	|t
�st
d��|�t||�t||�|S)z=
    Returns a connection to the address of a `Listener`
    rr�)	r=r5�
PipeClient�SocketClientr�r�r�r�r�)r<r.r�r�s    rrr�sq���
,�|�G�,�F��V��
����w�����!����:�g�u�#=��9�:�:�����G�$��!�W�%��Hrc�N�|rotj�\}}|jd�|jd�t|j	��}t|j	��}||fStj�\}}t|d��}t|d��}||fS)�L
        Returns pair of connection objects at either end of a pipe
        TF�rH�rG)r4�
socketpair�setblockingr��detachr(�pipe)�duplex�s1�s2�c1�c2�fd1�fd2s       rrrs�����&�&�(�F�B���N�N�4� ��N�N�4� ��B�I�I�K�(�B��B�I�I�K�(�B��2�v�
�	�w�w�y�H�C���C�%�0�B��C�%�0�B��2�v�
rc
��td�}|r>tj}tjtjz}t
t
}}n(tj}tj}dt
}}tj||tjztjztjtjztjzd||tjtj�}tj||dtjtj tjtj�}tj"|tjdd�tj$|d��}|j'd�\}	}
t)||��}t)||��}||fS)	rrrrNTr�rr
)r/r��PIPE_ACCESS_DUPLEX�GENERIC_READ�
GENERIC_WRITE�BUFSIZE�PIPE_ACCESS_INBOUND�CreateNamedPipe�FILE_FLAG_OVERLAPPED�FILE_FLAG_FIRST_PIPE_INSTANCE�PIPE_TYPE_MESSAGE�PIPE_READMODE_MESSAGE�	PIPE_WAIT�NMPWAIT_WAIT_FOREVER�NULL�
CreateFile�
OPEN_EXISTING�SetNamedPipeHandleState�ConnectNamedPiper�r�)
rr<�openmode�access�obsize�ibsize�h1�h2r��_r�rrs
             rrr(s`��$�I�.����1�1�H��)�)�G�,A�,A�A�F�$�g�F�F��2�2�H��*�*�F���F�F�
�
$�
$��X�� <� <�<��1�1�2��%�%��(E�(E�E����
�
�v�v�w�;�;��L�L����
�
��V�Q����g�.C�.C��(�(�'�,�,���	�'�'���-�-�t�T�	��-�-�b�T�B�
��/�/��5���3��B��
0��
�B��
0���2�v�
rc�$�eZdZdZdd�Zd�Zd�Zy)r�zO
    Representation of a socket which is bound to an address and listening
    c���tjtt|��|_	tjdk(r9|jjtjtjd�|jjd�|jj|�|jj|�|jj�|_||_d|_|dk(rCt#j$|�s.t#j&|tj(|fd��|_yd|_y#t$r|jj��wxYw)N�posixrTrr��args�exitpriority)r4�getattr�_socketr(�name�
setsockopt�
SOL_SOCKET�SO_REUSEADDRr�bind�listen�getsocknamerrQrX�_familyrrr;�Finalize�unlink�_unlink)rEr<r.r�s    rrIzSocketListener.__init__Xs���}�}�W�V�V�%<�=���	��w�w�'�!����'�'��(9�(9�(.�(;�(;�Q�@��L�L�$�$�T�*��L�L���g�&��L�L����(� �L�L�4�4�6�D�M����"����Y��t�'H�'H��'Q��=�=��b�i�i�w�j�q��D�L� �D�L���	��L�L��� ��	�s�B<E�%E)c��|jj�\}|_|jd�t	|j��S)NT)r9r�rrr�r�rE�ss  rr�zSocketListener.acceptqs9��!%���!4�!4�!6���4��	�
�
�d���!�(�(�*�%�%rc��	|jj�|j}|�d|_|�yy#|j}|�d|_|�wwxYwr)r9rXrD)rErCs  rrXzSocketListener.closevs[��	��L�L��� ��\�\�F��!�#�����"���\�\�F��!�#�����"�s	�:�AN)r)r�r�r�r�rIr�rXr�rrr�r�Ts��� �2&�
rr�c��t|�}tjtt|��5}|jd�|j	|�t|j
��cddd�S#1swYyxYw)zO
    Return a connection object connected to the socket given by `address`
    TN)r=r4r8r�connectr�r)r<r.rGs   rr	r	�sZ���'�
"�F�	������/�	1�Q�	�
�
�d��	�	�	�'���!�(�(�*�%�&�&�	1�	1�s�;A4�4A=c�6�eZdZdZdd�Zdd�Zd�Zed��Zy)	r�z0
        Representation of a named pipe
        Nc��||_|jd��g|_d|_t	j
d|j�t	j|tj|j|jfd��|_	y)NT)�firstz listener created with address=%rrr5)
r�_new_handle�
_handle_queuerr�	sub_debugrBr��_finalize_pipe_listenerrX)rEr<r�s   rrIzPipeListener.__init__�sl��#�D�M�"&�"2�"2��"2�">�!?�D��"&�D���N�N�=�t�}�}�M�����l�:�:��(�(�$�-�-�8�q��D�Jrc
�~�tjtjz}|r|tjz}tj|j
|tjtjztjztjtttjtj�Sr)
r�rr r!rrr"r#r$�PIPE_UNLIMITED_INSTANCESrr%r&)rErM�flagss   rrNzPipeListener._new_handle�s����.�.��1M�1M�M�E����>�>�>���*�*��
�
�u��)�)�G�,I�,I�I��!�!�"��0�0�'�7��,�,�g�l�l��
rc�L�|jj|j��|jjd�}	t	j
|d��}	t	j|jgdt�}	|jd�\}}t|�S#|j�t	j|��xYw#|jd�\}}wxYw#t$r2}|jtjk7r�Yd}~t|�Sd}~wwxYw)NrTr�F)rO�appendrN�popr�r*r�r�rr�r�r�rQr��
ERROR_NO_DATAr�)rErFr��resr1r�r�s       rr�zPipeListener.accept�s������%�%�d�&6�&6�&8�9��'�'�+�+�A�.�F�
$��-�-�f��F��	$�!�8�8����
�E�8�5�C� �3�3�D�9�F�A�s�!�&�)�)����I�I�K��'�'��/����3�3�D�9�F�A�s���
��:�:��!6�!6�6��7�"�&�)�)��!
�s0�C(�&B$�$(C�C�C%�(	D#�1D�D#c�h�tjd|�|D]}tj|��y)Nz closing listener with address=%r)rrPr�r�)�queuer<rFs   rrQz$PipeListener._finalize_pipe_listener�s)���N�N�=�w�G����#�#�F�+� rr)F)	r�r�r�r�rIrNr��staticmethodrQr�rrr�r��s*��	�		�
	�	*�.
�	,�
�	,rr�c	�.�t�}		tj|d�tj|tjtj
zdtjtjtjtj�}	tj|tjdd�t!|�S#t$rB}|jtjtjfvst|�r�Yd}~nd}~wwxYw��)zU
        Return a connection object connected to the pipe given by `address`
        ��rN)rr��
WaitNamedPiper'rrr&r(r rQr��ERROR_SEM_TIMEOUT�ERROR_PIPE_BUSYrr)r#r�)r<r�hr�s    rrr�s���
�O���
��%�%�g�t�4��&�&��W�1�1�G�4I�4I�I��w�|�|�W�%:�%:��0�0�'�,�,����	�'�'�
�w�,�,�d�D�	��a� � ���
��:�:�g�&?�&?�&-�&=�&=�&?�?�BP�QR�BS��CT��
��s�BC�	D�8D
�
D�(s#CHALLENGE#s	#WELCOME#s	#FAILURE#>�md5�sha256�sha384�sha3_256�sha3_384c#�2K�|]}t|����y�wr)r|)�.0r1s  r�	<genexpr>rkFs����7�&6��c�!�f�&6�s����message�returnc��t|�tvrd|fS|jd�rG|jddtdz�x}dkDr(|d|}|t
vr||dzd}|j
d�|fStd	|����)
aReturns a digest name and the payload for a response hash.

    If a legacy protocol is detected based on the message length
    or contents the digest name returned will be empty to indicate
    legacy mode where MD5 and no digest prefix should be sent.
    r$�{�}r�rN�asciizRunsupported message length, missing digest prefix, or unsupported digest: message=)r|�_LEGACY_LENGTHSr:�find�_MAX_DIGEST_LEN�_ALLOWED_DIGESTS�decoder	)rn�curly�digest�payloads    r�_get_digest_name_and_payloadr}Qs����7�|��&�
�7�{�����4� ��,�,�t�Q���(9�:�	:��a�?���5�!���%�%��e�A�g�h�'�G��=�=��)�7�2�2�
�
/�&-�Z�
1�2�2rc��ddl}t|�d}|s"	|j||d�j�S|j|||�j�}d|jd�|fzS#t$rd}Y�DwxYw)a�Create a MAC based on authkey and message

    The MAC algorithm defaults to HMAC-MD5, unless MD5 is not available or
    the message has a '{digest_name}' prefix. For legacy HMAC-MD5, the response
    is the raw MAC, otherwise the response is prefixed with '{digest_name}',
    e.g. b'{sha256}abcdefg...'

    Note: The MAC protects the entire message including the digest_name prefix.
    rN�md5�sha256�{%s}%srt)�hmacr}�newr{r,�encode)r�rnr��digest_name�responses     r�_create_responser�ks����.�w�7��:�K��	#��8�8�G�W�e�4�;�;�=�=��x�x���+�6�=�=�?�H���*�*�7�3�X�>�>�>���	#�#�K�		#�s� A.�.A<�;A<c
�d�ddl}t|�\}}|xsd}	|j|||�j�}t
|�t
|�k7r&td|�dt
|��dt
|�����|j||�std	��y#t$rtd|�d���wxYw)
a`Verify MAC challenge

    If our message did not include a digest_name prefix, the client is allowed
    to select a stronger digest_name from _ALLOWED_DIGESTS.

    In case our message is prefixed, a client cannot downgrade to a weaker
    algorithm, because the MAC is calculated over the entire message
    including the '{digest_name}' prefix.
    rNrzresponse_digest=z unsupportedz	expected z of length z got zdigest received was wrong)r�r}r�r{r,r	r|�compare_digest)r�rnr�r��response_digest�response_mac�expecteds       r�_verify_challenger��s����$@��$J�!�O�\�%�.��O�E��8�8�G�W�o�>�E�E�G���8�}��L�)�)�!��O�.�k�#�h�-��I��<�(�)�+�,�	,����x��6�!�"=�>�>�7��
�E�!�%5�_�$6�l�"C�D�D�E�s�!B�B/r�c��t|t�s#tdjt	|����tjt�}d|jd�|fz}|jt|z�|jd�}	t|||�|jt�y#t$r|jt��wxYw)N� Authkey must be bytes, not {0!s}r�rt�)r�r�r,�formatr7r(�urandom�MESSAGE_LENGTHr�ro�
_CHALLENGErzr��_WELCOMEr	�_FAILURE)�
connectionr�r�rnr�s     rr�r��s����g�u�%��.�5�5�d�7�m�D�F�	F��j�j��(�G��;�-�-�g�6��@�@�G����*�w�.�/��$�$�S�)�H�(��'�7�H�5�
	���h�'��	�����h�'�
��s�

B0�0 Cc��t|t�s#tdjt	|����|jd�}|j
t�std|����|tt�d}t|�tkrtd��t||�}|j|�|jd�}|tk7rtd��y)Nr�r�z,Protocol error, expected challenge: message=z)challenge too short: {len(message)} byteszdigest sent was rejected)r�r�r,r�r7rzr:r�r	r|�_MD5ONLY_MESSAGE_LENGTHr�ror�)r�r�rnr{r�s     rr�r��s����g�u�%��.�5�5�d�7�m�D�F�	F��#�#�C�(�G����j�)�!�?�w�j�A�C�	C��c�*�o�&�'�G�
�7�|�-�-�!�"M�N�N�
�g�w�
/�F����&�!��$�$�S�)�H��8��!�"<�=�=�rc��eZdZd�Zd�Zd�Zy)�ConnectionWrapperc�n�||_||_||_dD]}t||�}t	|||��y)N)rarXr�rzro)�_conn�_dumps�_loadsr8�setattr)rE�connrrr��attrrts      rrIzConnectionWrapper.__init__�s:����
�������K�D��$��%�C��D�$��$�Lrc�\�|j|�}|jj|�yr)r�r�ro)rErtrGs   rruzConnectionWrapper.send�s"���K�K�����
�
���a� rc�X�|jj�}|j|�Sr)r�rzr�rFs  rr�zConnectionWrapper.recv�s"���J�J�!�!�#���{�{�1�~�rN)r�r�r�rIrur�r�rrr�r��s��%�!�rr�c�T�tj|fdddd�jd�S)Nr�utf-8)�	xmlrpclibrrr�)rts r�
_xml_dumpsr��s&���?�?�C�6�4��t�Q�7�>�>�w�G�Grc�X�tj|jd��\\}}|S)Nr�)r�r�ry)rGrt�methods   r�
_xml_loadsr��s$���_�_�Q�X�X�g�%6�7�N�F�S�F��Jrc��eZdZd�Zy)�XmlListenerc�b�ddlmatj	|�}t|tt�Sr�)�
xmlrpc.client�clientr�rr�r�r�r�rss  rr�zXmlListener.accept�s"��)��o�o�d�#�� ��j�*�=�=rN)r�r�r�r�r�rrr�r��s��>rr�c�J�ddlmatt	|i|��t
t�Sr�)r�r�r�r�rr�r�)r6�kwdss  r�	XmlClientr��s��%��V�T�2�T�2�J�
�K�Krc��t|�}g}|r�tj|d|�}|tk(r	|St|cxkrtt|�zkr
nn
|tz}nAt|cxkrtt|�zkrntd��|tz}ntd��|j||�||dzd}d}|r��|S)NFzShould not get hererr)	�listr�r�rrr|r
r�rV)�handlesr�L�readyrYs     r�_exhaustive_waitr��s���
��M������0�0��E�7�C�C��l�"�����#�>�
��A��(>�>��}�$��!�S�D�+;�c�!�f�+D�D�#�#8�9�9��'�'��"�#8�9�9��L�L��3�� ��#�a�%�&�	�A��G���rc�V��|�t}n|dkrd}nt|dzdz�}t|�}i�g}t�}t�}	|D]�}	t	|d�}	tj|�dd�\}}|t
jk(r!|j|�|�|j<�d|rDtj�dddk\r*	|jd	�\}
}|st!|d
�rd|_|j%|�d}��t+�j-�|�}|D]}|j/��|D]e}	|jd�\}
}|t
j0k7s�,�|j}|j%|�|dk(s�Rt!|d
�s�_d|_�g	|j3�fd�|D��|D�cgc]	}||vs�|��c}S#t$r"}	d|	j}}|tvr�Yd}	~	���d}	~	wwxYw#t$r}	|	j}Yd}	~	��>d}	~	wwxYw#t&$r|�|j)�<Y���wxYw#t$r }	|	j}|tvr�Yd}	~	��d}	~	wwxYw#|D]}|j/��|D]�}	|jd�\}
}n+#t$r}	|	j}|tvr�Yd}	~	nd}	~	wwxYw|t
j0k7s�X�|j}|j%|�|dk(s�~t!|d
�s��d|_��wxYwcc}w)��
        Wait till an object in object_list is ready/readable.

        Returns list of those objects in object_list which are ready/readable.
        Nrr^g�?raTrs)�rsFr�c3�(�K�|]	}�|���y�wrr�)rjrb�waithandle_to_objs  �rrkzwait.<locals>.<genexpr>Ss�����I�=�a�.�q�1�=�s�)r�intr��setr8r�r�rQr��
_ready_errorsr�rVr�r1�getwindowsversionr�r3r��add�AttributeErrorrAr��keysr�r��update)�object_listr�ov_list�
ready_objects�
ready_handles�orar�r�r�r1r�s           @rrrs-����?��G�
�q�[��G��'�D�.�3�.�/�G��;�'��������
���
�6	8� ��$�$�Q��1�F�
"�")�"2�"2�6�8�Q��"E���C�
�g�6�6�6����r�*�67�)�"�(�(�3�
�#�"7�"7�"9�"�1�"=��"G�1�)+�)?�)?��)F���3�$'�7�1�6J�+K�7;�� 4�%�)�)�!�,�"#��=!�@-�->�-C�-C�-E�w�O�M����	�	�������3�3�D�9�F�A�s�
�'�9�9�9�)�"�(�(�3�A�!�%�%�a�(��a�x�#�1�&:�;�37�A�0�� 	���I�=�I�I�&�=�;�a�!�}�*<��;�=�=��_#�"�"&��
�
�C���m�3�!�4��"�� $+�1�&'�j�j���1��-&�9�78�%�a�k�k�m�4�9��N���*�*�C��-�/��0�������	�	�������3�3�D�9�F�A�s�����*�*�C��-�/��0�����'�9�9�9�)�"�(�(�3�A�!�%�%�a�(��a�x�#�1�&:�;�37�A�0���">s��I4�H%�G�:AI4�H�AI4�I�	L&�
L&�	G?�G:�4I4�:G?�?I4�	H"�H�I4�H"�"I4�%I�I4�I�I4�	I1�I,�,I1�4L#�J'�&L#�'	K	�0K
	�L#�
K	�L#�&%L#�L#�
L#�PollSelectorc��t�5}|D]"}|j|tj��$|�t	j
�|z}	|j
|�}|r(|D��cgc]\}}|j��c}}cddd�S|�'t	j
�z
}|dkr|cddd�S�ecc}}w#1swYyxYw)r�Nr)�
_WaitSelector�register�	selectors�
EVENT_READrr�select�fileobj)r�r�selectorrt�deadliner��key�eventss        rrrbs����_��"���!�!�#�y�';�';�<�#��"��>�>�+�g�5��� ����0���=B�C�U�M�S�&�C�K�K�U�C�	)�	)��*�"*�T�^�^�-=�"=��"�Q�;�#(�	)�	)���D��_�s$�AB8�%B2�;B8�B8�1B8�8Cc� �|j�}tj|tjtj�5}ddlm}|j|�}t||j|jffcddd�S#1swYyxYw)Nr)�resource_sharer)rar4�fromfdr�SOCK_STREAMr$r��	DupSocket�rebuild_connectionrGrH)r�rFrGr��dss     r�reduce_connectionr�~sf�������
�]�]�6�6�>�>�6�3E�3E�
F�!�)� �*�*�1�-�B�%��D�M�M�4�=�=�'I�I�	J�	J�
F�
F�s�6B�B
c�X�|j�}t|j�||�Sr�rr�)r�rGrH�socks    rr�r��s"���y�y�{���$�+�+�-��8�<�<rc��|jrtjnd|jrtjndz}tj|j�|�}t||j|jffSr�)	rGr��FILE_GENERIC_READrH�FILE_GENERIC_WRITEr�	DupHandlera�rebuild_pipe_connection)r�r,�dhs   r�reduce_pipe_connectionr��s^��04�
�
�7�,�,�1�15���7�-�-�A�G��
�
 �
 ������
7��&��T�]�]�D�M�M�(J�J�Jrc�<�|j�}t|||�Sr)rr�)r�rGrHrFs    rr�r��s��������f�h��9�9rc��tj|j��}t||j|j
ffSr)r�DupFdrar�rGrH)r��dfs  rr�r��s0��
�_�_�T�[�[�]�
+��!�B��
�
�t�}�}�#E�E�Erc�<�|j�}t|||�Srr�)r�rGrH�fds    rr�r��s��
�Y�Y�[���"�h��1�1r)NN)T)r�r)V�__all__r�r�r(r1r4r�rr%�	itertoolsr�r$rr	r
�contextr�ForkingPicklerrqr�rr
rr�ImportErrorr2r�CONNECTION_TIMEOUT�countr+r��familiesr3rrr/r5r=r?r�r��objectrrrr�r	r�rr�r�r�r��	frozensetrx�maxrwr��_MD5_DIGEST_LENrur�r9r}r�r�r�r�r�r�r�r�r�r�r��ERROR_NETNAME_DELETEDr�rr�r�r��SelectSelectorr�r�r�r�r�r�rr�<module>r�s���3���	�	�
�
�
������1���*�*����O�O������	���!�
����;��
�6�9���N�����H��<�<�7���N�����H�-�&� �0�
F�
F�&T�T�n�]��]�@M��M�h;�v�;�|
�*�<�<�7���&&�X)�V�)�X&��<�<�7��6,�v�6,�p!�>��
�
�����r�@�B���7�&6�7�7������*�O�<��2�%�2�S�%�L�2�4?�8?�2(�5�(�*>�%�>�*
��
�H��>�(�>�L��<�<�7���(�.�.��0M�0M�N�M�L>�`�
�y�.�)�!�.�.�
�!�0�0�
�)�6�<�<�7��J�=��I���z�#4�5�K�
:��I���~�'=�>�F�2��I���z�#4�5��s#��
�|�|�w��
��G��s�H?�?I�I