Your IP : 52.15.190.187


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-2.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	��)
Nr)�	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/Fs~�������	�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)NrrzFamily %s is not recognized.r)�sys�platformr,�hasattr�socketr-s r�_validate_familyr5Tsh����|�|�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��)Nrz\\rrzaddress type of %r unrecognized)�type�tuple�str�
startswithr�is_abstract_socket_namespacer,)�addresss r�address_typer=`sa���
�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� �	|jduSr�rBrMs r�closedz_ConnectionBase.closed�s��.��|�|�t�#�#rc��	|jSr)rCrMs rrGz_ConnectionBase.readable����0��~�~�rc��	|jSr)rDrMs rrHz_ConnectionBase.writable�r^rc�<�	|j�|jSr)rRrBrMs r�filenoz_ConnectionBase.fileno�s��9������|�|�rc�h�	|j�	|j�d|_yy#d|_wxYwrrKrMs rrXz_ConnectionBase.close�s4��"��<�<�#�
$����
�#���	$�� $���s�(�	1c�x�	|j�|j�t|�}|jdkDr|j	d�}|j
}|dkrt
d��||krt
d��|�||z
}n#|dkrt
d��||z|kDrt
d��|j||||z�y)Nr�Brzoffset is negativezbuffer length < offsetzsize 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	|��yr)rRrVri�_ForkingPickler�dumps�rE�objs  r�sendz_ConnectionBase.send�s6��'�������������.�.�s�3�4rc���	|j�|j�|�|dkrtd��|j|�}|�|j	�|j�S)Nrznegative maxlength)rRrTr,�_recv_bytesrY�getvalue)rE�	maxlengthrjs   r�
recv_bytesz_ConnectionBase.recv_bytes�sf��	�	
��������� �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)Nrznegative offsetzoffset too large)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��Sr)rRrTrwrq�loads�	getbuffer)rErjs  r�recvz_ConnectionBase.recv�sB��*������������ ���$�$�S�]�]�_�5�5rc�f�	|j�|j�|j|�Sr)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�N�eZdZ	dZdZejfd�Zd�Zdd�Z	d�Z
d�Zy)	�PipeConnectionFNc�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�r�r�r��CloseHandlerLrirwr�r�r�rrr�r�s8��	�
#����&-�&9�&9�	'�	(�4	Q�@	/�
	rr�c���eZdZ	er(ej
fd�ZejZejZ
n'ejfd�ZejZejZ
efd�Ze
fd�Zd�Zd	d�Zd�Zy)
�
Connectionc�(�||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��_multiprocessing�closesocketrLru�_writer��_readr(rXr�r�r�r�rirwr�r�rrr�r�lso���
� 0� <� <�	!�!�&�&�� �%�%�� "���	!���������%�� %�� )�. �rr�c�N�eZdZ	d	d�Zd�Zd�Zed��Zed��Zd�Z	d�Z
y)
rNc��|xs|xrt|�xst}|xst|�}t|�|dk(rt	||�|_nt
|||�|_|�t|t�std��||_
y�Nrzauthkey 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)Nzlistener is closed)r�rQ�acceptr��deliver_challenge�answer_challenge)rE�cs  rr�zListener.accept�s\��	�
�>�>�!��.�/�/��N�N�!�!�#���=�=�$��a����/��Q��
�
�.��rc�R�	|j}|�d|_|j�yyr)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�rIr�rXr�r<rr�r�r�rrrr�sH��� � 
���'��'��-��-��rrc���	|xst|�}t|�|dk(rt|�}nt|�}|�t	|t
�st
d��|�t||�t||�|Sr�)	r=r5�
PipeClient�SocketClientr�r�r�r�r�)r<r.r�r�s    rrr�sv����
,�|�G�,�F��V��
����w�����!����:�g�u�#=��9�:�:�����G�$��!�W�%��Hrc�P�	|rotj�\}}|jd�|jd�t|j	��}t|j	��}||fStj�\}}t|d��}t|d��}||fS)NTF�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)NrrrTr�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(se��	�$�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�"�eZdZ	dd�Zd�Zd�Zy)r�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)r7r�rr
r�r�rE�ss  rr�zSocketListener.acceptqs9��!%���!4�!4�!6���4��	�
�
�d���!�(�(�*�%�%rc��	|jj�|j}|�d|_|�yy#|j}|�d|_|�wwxYwr)r7rXrB)rErAs  rrXzSocketListener.closevs[��	��L�L��� ��\�\�F��!�#�����"���\�\�F��!�#�����"�s	�:�AN)r)r�r�r�rIr�rXr�rrr�r�Ts��� �2&�
rr�c��	t|�}tjtt|��5}|jd�|j	|�t|j
��cddd�S#1swYyxYwrD)r=r4r6r
�connectr�r)r<r.rFs   rrr�s_����'�
"�F�	������/�	1�Q�	�
�
�d��	�	�	�'���!�(�(�*�%�&�&�	1�	1�s�;A5�5A>c�4�eZdZ	dd�Zdd�Zd�Zed��Zy)r�Nc��||_|jd��g|_d|_t	j
d|j�t	j|tj|j|jfd��|_	y)NT)�firstz listener created with address=%rrr3)
r�_new_handle�
_handle_queuerr�	sub_debugr@r��_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�rrrrrr r!r"�PIPE_UNLIMITED_INSTANCESrr#r$)rErL�flagss   rrMzPipeListener._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)rN�appendrM�popr�r(r�r�rr�r�r�rQr��
ERROR_NO_DATAr�)rErFr��resr/r�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)rrOr�r�)�queuer<rFs   rrPz$PipeListener._finalize_pipe_listener�s)���N�N�=�w�G����#�#�F�+� rr)F)r�r�r�rIrMr��staticmethodrPr�rrr�r��s*��	�		�
	�	*�.
�	,�
�	,rr�c	�0�	t�}		tj|d�tj|tjtj
zdtjtjtjtj�}	tj|tjdd�t!|�S#t$rB}|jtjtjfvst|�r�Yd}~nd}~wwxYw��)N��r)rr��
WaitNamedPiper%rrr$r&rrQr��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|)�.0r/s  r�	<genexpr>rjFs����7�&6��c�!�f�&6�s����message�returnc��	t|�tvrd|fS|jd�rG|jddtdz�x}dkDr(|d|}|t
vr||dzd}|j
d�|fStd|����)	Nr$�{�}r�r�asciizRunsupported message length, missing digest prefix, or unsupported digest: message=)r|�_LEGACY_LENGTHSr:�find�_MAX_DIGEST_LEN�_ALLOWED_DIGESTS�decoder	)rm�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)Nr�md5�sha256�{%s}%srs)�hmacr|�newrzr,�encode)r�rmr��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
�f�	ddl}t|�\}}|xsd}	|j|||�j�}t
|�t
|�k7r&td|�dt
|��dt
|�����|j||�std��y#t$rtd|�d���wxYw)	Nrr~zresponse_digest=z unsupportedz	expected z of length z got zdigest received was wrong)r�r|r�rzr,r	r|�compare_digest)r�rmr�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�B0r�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�rs�)r�r�r,�formatr7r(�urandom�MESSAGE_LENGTHr�ro�
_CHALLENGErzr��_WELCOMEr	�_FAILURE)�
connectionr�r�rmr�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�rmrzr�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�_loadsr6�setattr)rE�connrrr��attrrts      rrIzConnectionWrapper.__init__�s:����
�������K�D��$��%�C��D�$��$�Lrc�\�|j|�}|jj|�yr)r�r�ro)rErtrFs   rruzConnectionWrapper.send�s"���K�K�����
�
���a� rc�X�|jj�}|j|�Sr)r�rzr�rEs  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�rx)rFrt�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�)r4�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�rU)�handlesr�L�readyrXs     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�X��	|�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)Nrr]g�?raTrr)�rrFr�c3�(�K�|]	}�|���y�wrr�)rira�waithandle_to_objs  �rrjzwait.<locals>.<genexpr>Ss�����I�=�a�.�q�1�=�s�)r�intr��setr6r�r�rQr��
_ready_errorsr�rUr�r1�getwindowsversionr�r3r��add�AttributeErrorrAr��keysr�r��update)�object_listr�ov_list�
ready_objects�
ready_handles�orar�r�r�r/r�s           @rrrs2���	�
�?��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��	I5�H&�G�;AI5�H� AI5�I	�	L'�L'�	H�G;�5I5�;H�I5�	H#�H�I5�H#�#I5�&I�I5�I�I5�		I2�I-�-I2�5L$�J(�'L$�(	K	�1K	�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#1swYyxYwr�)�
_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$�AB9�&B3�<B9�	B9�2B9�9Cc� �|j�}tj|tjtj�5}ddlm}|j|�}t||j|jffcddd�S#1swYyxYw)Nr)�resource_sharer)rar4�fromfdr�SOCK_STREAMr$r��	DupSocket�rebuild_connectionrGrH)r�rFrFr��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)rr)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�rr�rr�r�r�r��	frozensetrw�maxrvr��_MD5_DIGEST_LENrtr�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

?>