AlkantarClanX12

Your IP : 18.117.12.181


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

�

c��f�~���gd�ZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddlm
Z
mZddlmZejZ	ddlZddlmZmZmZmZn#e$rejdkr�dZYnwxYwd	Zd
Ze	j��ZdZdgZe ed��rdZedgz
Zejdkrd
Zed
gz
Zefd�Z!d�Z"d�Z#d�Z$d�Z%Gd�d��Z&erGd�de&��Z'Gd�de&��Z(Gd�de)��Z*d<d�Z+ejdkrd=d�Z,nd=d�Z,Gd�d e)��Z-d!�Z.ejdkrGd"�d#e)��Z/d$�Z0d%Z1d&Z2d'Z3d(Z4d)�Z5d*�Z6Gd+�d,e)��Z7d-�Z8d.�Z9Gd/�d0e*��Z:d1�Z;ejdkrd2�Z<ej=ej>hZ?d>d3�Z@n#ddlAZAe eAd4��reAjBZCneAjDZCd>d5�Z@ejdkr0d6�ZEd7�ZFejGe(eE��d8�ZHd9�ZIejGe'eH��dSd:�ZEd;�ZFejGe(eE��dS)?)�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�.�tj��|zS�N��time�	monotonic)�timeouts �A/opt/alt/python311/lib64/python3.11/multiprocessing/connection.py�
_init_timeoutr<s���>���g�%�%�c�0�tj��|kSrr)�ts r�_check_timeoutr?s���>���a��rc��|dkrdS|dkr'tjdtj�����S|dkr>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/Fs���������	�9�	�	���k�t�7H�7J�7J�K�K�K�K�	�9�	�	���&<� "�	���T�-�-@�-@�A�'B�GI�K�K�K�	K��.�/�/�/rc���tjdkr|dkrtd|z���tjdkr-|dkr)tt|��std|z���dSdSdS)zD
    Checks if the family is valid for the current environment.
    rrzFamily %s is not recognized.rN)�sys�platformr,�hasattr�socketr-s r�_validate_familyr5Ts����|�w���6�Y�#6�#6��7�&�@�A�A�A�
�|�w���6�Y�#6�#6��v�v�&�&�	F��;�f�D�E�E�E���#6�#6�	F�	Frc��t|��tkrdSt|��tur|�d��rdSt|��tust	j|��rdSt
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�}�}�����y�	
�g���#�	�	�'�"4�"4�V�"<�"<�	��y�	
�g���#�	�	��!B�7�!K�!K�	��y��:�W�D�E�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�ZdS)�_ConnectionBaseNTc��|���}|dkrtd���|s|std���||_||_||_dS)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__vsm���!�!�#�#���A�:�:��-�.�.�.��	J��	J��H�J�J�
J����!���!����rc�@�|j�|���dSdSr�rB�_close�rEs r�__del__z_ConnectionBase.__del__�s#���<�#��K�K�M�M�M�M�M�$�#rc�2�|j�td���dS)N�handle is closed)rB�OSErrorrMs r�
_check_closedz_ConnectionBase._check_closed�s!���<���,�-�-�-� �rc�2�|jstd���dS)Nzconnection is write-only)rCrQrMs r�_check_readablez_ConnectionBase._check_readable�s%���~�	6��4�5�5�5�	6�	6rc�2�|jstd���dS)Nzconnection is read-only)rDrQrMs r�_check_writablez_ConnectionBase._check_writable�s%���~�	5��3�4�4�4�	5�	5rc�f�|jrd|_n|���td���)NFzbad message length)rDrC�closerQrMs r�_bad_message_lengthz#_ConnectionBase._bad_message_length�s1���>�	�"�D�N�N��J�J�L�L�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�8�|���|jS)z+File descriptor or handle of the connection)rRrBrMs r�filenoz_ConnectionBase.fileno�s���������|�rc�h�|j�*	|���d|_dS#d|_wxYwdS)zClose the connectionNrKrMs rrXz_ConnectionBase.close�sB���<�#�
$����
�
�
�#������t���#�#�#�#�	$�#s�&�	/rc��|���|���t|��}|jdkr|�d��}|j}|dkrt
d���||krt
d���|�||z
}n-|dkrt
d���||z|krt
d���|�||||z���dS)	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�O���:��>�>����s���A�
�H���A�:�:��1�2�2�2��v�:�:��5�6�6�6��<��v�:�D�D�
�A�X�X��/�0�0�0�
�d�]�Q�
�
��<�=�=�=�����6�&�4�-�/�0�1�1�1�1�1rc��|���|���|�t�|����dS)zSend a (picklable) objectN)rRrVri�_ForkingPickler�dumps�rE�objs  r�sendz_ConnectionBase.send�sN������������������.�.�s�3�3�4�4�4�4�4rc��|���|���|�|dkrtd���|�|��}|�|���|���S)z7
        Receive bytes data as a bytes object.
        Nrznegative maxlength)rRrTr,�_recv_bytesrY�getvalue)rE�	maxlengthrjs   r�
recv_bytesz_ConnectionBase.recv_bytes�s}��	
������������� �Y��]�]��1�2�2�2����y�)�)���;��$�$�&�&�&��|�|�~�~�rc�H�|���|���t|��5}|j}|t	|��z}|dkrtd���||krtd���|���}|���}|||zkr!t|�	�����|�
d��|�|||z||z|z���|cddd��S#1swxYwYdS)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�sj��
	
������������
��_�_�	���z�H��#�a�&�&�(�H���z�z� �!2�3�3�3��(�"�"� �!3�4�4�4��%�%�'�'�F��;�;�=�=�D��&�4�-�'�'�$�V�_�_�%6�%6�7�7�7��K�K��N�N�N��O�O�A�f��0�%��}��9�:�;�
<�
<�
<��!	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�CD�D�Dc���|���|���|���}t�|�����S)zReceive a (picklable) object)rRrTrwrq�loads�	getbuffer)rErjs  r�recvz_ConnectionBase.recv�sS����������������� � ���$�$�S�]�]�_�_�5�5�5r�c�|�|���|���|�|��S)z/Whether there is any input available to be read)rRrT�_poll�rErs  r�pollz_ConnectionBase.poll�s8���������������z�z�'�"�"�"rc��|Sr�rMs r�	__enter__z_ConnectionBase.__enter__����rc�.�|���dSr�rX�rE�exc_type�	exc_value�exc_tbs    r�__exit__z_ConnectionBase.__exit__����
�
�����r)TT)rNr)r)r�)�__name__�
__module__�__qualname__rBrIrNrRrTrVrY�propertyr\rGrHrarXrorurzr�r�r�r�r�r�rrr?r?sss�������G�	"�	"�	"�	"����.�.�.�6�6�6�5�5�5�,�,�,��$�$��X�$�����X������X�����
$�$�$�2�2�2�2�(5�5�5���������26�6�6�#�#�#�#��������rr?c�H�eZdZdZdZdZejfd�Zd�Z	d	d�Z
d�Zd�ZdS)
�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�`�|j}|�|���||j��dSr)�_send_ov�cancelrB)rE�_CloseHandle�ovs   rrLzPipeConnection._closes3����B��~��	�	�����L���&�&�&�&�&rc���|j�td���tj|j|d���\}}||_	|tjkr!tj|jgdt��}n#|�	���xYwd|_|�
d��\}}n$#d|_|�
d��\}}wxYw|tjkrttjd���dS)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�6��'���c�d�K�K�K�G�B���D�M�

=��'�2�2�2�%�<���
�E�8�5�5�G���
��	�	�������� $��
� "� 6� 6�t� <� <�
��#�#��!%��
� "� 6� 6�t� <� <�
��#�<�<�<�<��g�5�5�5��e�k�+=�>�>�>�	6�5s�1A0�/B*�0B�B*�*!Cc���|jrd|_tj��S|�dnt|d��}	t	j|j|d���\}}	|tjkr!t	j|j	gdt��}n#|����xYw|�d��\}}|dkr<tj��}|�
|�����|S|tjkr|�||��Sn�#|�d��\}}|dkr@tj��}|�
|�����|ccYS|tjkr|�||��ccYSwxYwn/#t"$r"}|jtjkrt(��d}~wwxYwt+d���)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�|�|�#�&����C���4E�4E���%�.�t�|�U�;?�A�A�A�G�B��D��'�":�:�:�&-�&D�!#��
�E�8�'=�'=�G�����	�	��������%'�%;�%;�D�%A�%A�
��s��!�8�8� "�
���A��G�G�B�L�L�N�N�3�3�3�#$�H� �G�$;�;�;�#'�#6�#6�r�7�#C�#C�C�<��&(�%;�%;�D�%A�%A�
��s��!�8�8� "�
���A��G�G�B�L�L�N�N�3�3�3�#$�H�H�H�H�H� �G�$;�;�;�#'�#6�#6�r�7�#C�#C�C�C�C�C�C�C�C�C�C�<�������z�W�%>�>�>�&�������	����
�O�P�P�Psg�F2�1B	�D$�	B � D$�#AF2�=%F2�#F2�$AF.�F2�(F.�+F2�-F.�.F2�2
G�<G�Gc��|js#tj|j��ddkrdSt	t|g|����S)NrT)r�r��
PeekNamedPiperB�boolrr�s  rr�zPipeConnection._pollVsI���'�
��-�d�l�;�;�A�>�!�C�C��t���d�V�W�-�-�.�.�.rc���|���}tj��}|�|��t	j|j��d}|�*t|��|z|kr|���t	j	|j|d���\}}|�
d��\}}|�|�����|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�L�L��(���6�6�q�9�D��"�s�3�x�x�$���'@�'@��(�(�*�*�*��&�t�|�T�d�K�K�K�G�B���0�0��6�6�K�F�C�
�G�G�B�L�L�N�N�#�#�#��Hrr)
r�r�r��__doc__r�r�r��CloseHandlerLrirwr�r�r�rrr�r�s�������	�	�
#����&-�&9�	'�	'�	'�	'�	(�	(�	(�4	Q�	Q�	Q�	Q�@	/�	/�	/�
	�
	�
	�
	�
	rr�c��eZdZdZerejfd�ZejZ	ej
Znej
fd�ZejZ	ejZe	fd�Zefd�Zd�Zd
d�Zd	�ZdS)�
Connectionzo
    Connection class based on an arbitrary file descriptor (Unix only), or
    a socket handle (Windows).
    c�&�||j��dSrr[�rErLs  rrLzConnection._closes����F�4�<� � � � � rc�&�||j��dSrr[r�s  rrLzConnection._closexr�rc�t�t|��}	||j|��}||z}|dkrdS||d�}�))NTr)r|rB)rErjr��	remainingrns     r�_sendzConnection._send}sN����H�H�	�	���d�l�C�(�(�A���N�I��A�~�~����a�b�b�'�C�	rc��tj��}|j}|}|dkr]|||��}t|��}|dkr||krt�td���|�|��||z}|dk�]|S)Nrzgot end of file during message)r�r�rBr|r�rQr�)rErl�readrjrFr��chunkrns        r�_recvzConnection._recv�s����j�l�l������	��!�m�m��D���+�+�E��E�
�
�A��A�v�v���$�$�"�N�!�"B�C�C�C��I�I�e������N�I��!�m�m��
rc���t|��}|dkrktjdd��}tjd|��}|�|��|�|��|�|��dStjd|��}|dkr,|�|��|�|��dS|�||z��dS)Ni����!i����!Qi@)r|�struct�packr�)rErjrn�
pre_header�headers     rrizConnection._send_bytes�s�����H�H���z�>�>���T�2�.�.�J��[��q�)�)�F��J�J�z�"�"�"��J�J�v�����J�J�s�O�O�O�O�O��[��q�)�)�F��5�y�y��
�
�6�"�"�"��
�
�3�������
�
�6�C�<�(�(�(�(�(rNc�D�|�d��}tjd|�����\}|dkr>|�d��}tjd|�����\}|�||krdS|�|��S)N�r�r��r�)r�r��unpackrx)rEr�rjrls    rrwzConnection._recv_bytes�s����j�j��m�m���
�d�C�L�L�N�N�3�3����2�:�:��*�*�Q�-�-�C��M�$������7�7�E�D���4�'�>�>��4��z�z�$���rc�B�t|g|��}t|��Sr)rr�)rEr�rs   rr�zConnection._poll�s���$���!�!���A�w�w�rr)r�r�r�r�r��_multiprocessing�closesocketrLru�_writer��_readr(rXr�r�r�r�rirwr�r�rrr�r�ls���������
�	� 0� <�	!�	!�	!�	!�!�&�� �%��� "��	!�	!�	!�	!�������%����� %����� )�)�)�. � � � �����rr�c�^�eZdZdZdd�Zd�Zd�Zed���Zed���Z	d	�Z
d
�ZdS)rz�
    Returns a listener object.

    This is a wrapper for a bound socket which is 'listening' for
    connections, or for a Windows named pipe.
    Nrc�8�|p|rt|��pt}|pt|��}t|��|dkrt	||��|_nt
|||��|_|�$t|t��std���||_
dS)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�6���� � � ��Y���)�'�7�;�;�D�N�N�+�G�V�W�E�E�D�N���z�'�5�'A�'A���=�>�>�>���
�
�
rc���|j�td���|j���}|j�*t	||j��t||j��|S)zz
        Accept a connection on the bound socket or named pipe of `self`.

        Returns a `Connection` object.
        Nzlistener is closed)r�rQ�acceptr��deliver_challenge�answer_challenge)rE�cs  rr�zListener.accept�s_���>�!��.�/�/�/��N�!�!�#�#���=�$��a���/�/�/��Q��
�.�.�.��rc�R�|j}|�d|_|���dSdS)zA
        Close the bound socket or named pipe of `self`.
        N)r�rX)rE�listeners  rrXzListener.close�s6���>����!�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�.�|���dSrr�r�s    rr�zListener.__exit__�r�r)NNrN)r�r�r�r�rIr�rXr�r<rr�r�r�rrrr�s��������� � � � � 
�
�
�����'�'��X�'��-�-��X�-��������rrc� �|pt|��}t|��|dkrt|��}nt|��}|�$t	|t
��st
d���|� t||��t||��|S)z=
    Returns a connection to the address of a `Listener`
    rNr�)	r=r5�
PipeClient�SocketClientr�r�r�r�r�)r<r.r�r�s    rrr�s����
,�|�G�,�,�F��V����
�����w�������!�!����:�g�u�#=�#=���9�:�:�:�����G�$�$�$��!�W�%�%�%��HrTc��|r�tj��\}}|�d��|�d��t|�����}t|�����}n8tj��\}}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����		1��&�(�(�F�B���N�N�4� � � ��N�N�4� � � ��B�I�I�K�K�(�(�B��B�I�I�K�K�(�(�B�B��w�y�y�H�C���C�%�0�0�0�B��C�%�0�0�0�B��2�v�
rc
��td��}|r4tj}tjtjz}t
t
}}n!tj}tj}dt
}}tj||tjztj	ztj
tjztjzd||tj
tj��}tj||dtjtjtjtj��}tj|tjdd��tj|d���}|�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(sW��$�I�.�.���	(��1�H��)�G�,A�A�F�$�g�F�F�F��2�H��*�F���F�F�
�
$��X�� <�<��1�2��%��(E�E���
�
�v�v�w�;��L�����
��V�Q���g�.C��(�'�,����	�'���-�t�T�	�	�	��-�b�T�B�B�B�
��/�/��5�5���3��B��
0�
0�
0��
�B��
0�
0�
0���2�v�
rc�&�eZdZdZdd�Zd�Zd�ZdS)r�zO
    Representation of a socket which is bound to an address and listening
    rc��tjtt|����|_	tjdkr0|j�tjtjd��|j�d��|j�	|��|j�
|��|j���|_n(#t$r|j����wxYw||_d|_|dkr>t#j|��s*t#j|tj|fd���|_dSd|_dS)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__XsF���}�W�V�V�%<�%<�=�=���	��w�'�!�!���'�'��(9�(.�(;�Q�@�@�@��L�$�$�T�*�*�*��L���g�&�&�&��L����(�(�(� �L�4�4�6�6�D�M�M���	�	�	��L��� � � ��	�������"����Y���t�'H��'Q�'Q���=��b�i�w�j�q����D�L�L�L� �D�L�L�Ls�B,C�%Dc��|j���\}|_|�d��t	|�����S)NT)r9r�rrr�r�rE�ss  rr�zSocketListener.acceptqsE��!%��!4�!4�!6�!6���4��	�
�
�d�����!�(�(�*�*�%�%�%rc��	|j���|j}|�d|_|��dSdS#|j}|�d|_|��wwxYwr)r9rXrD)rErCs  rrXzSocketListener.closevsr��	��L��� � � ��\�F��!�#����������"�!���\�F��!�#���������"���s	�9�AN)r)r�r�r�r�rIr�rXr�rrr�r�TsP�������� � � � �2&�&�&�
����rr�c�8�t|��}tjtt|����5}|�d��|�|��t|�����cddd��S#1swxYwYdS)zO
    Return a connection object connected to the socket given by `address`
    TN)r=r4r8r�connectr�r)r<r.rGs   rr	r	�s����'�
"�
"�F�	�����/�/�	1�	1�&�Q�	�
�
�d����	�	�	�'�����!�(�(�*�*�%�%�&�&�&�&�&�&�&�&�&�&�&�&����&�&�&�&�&�&s�AB�B�Bc�>�eZdZdZdd�Zd	d�Zd�Zed���ZdS)
r�z0
        Representation of a named pipe
        Nc���||_|�d���g|_d|_t	jd|j��t	j|tj|j|jfd���|_	dS)NT)�firstz listener created with address=%rrr5)
r�_new_handle�
_handle_queuerr�	sub_debugrBr��_finalize_pipe_listenerrX)rEr<r�s   rrIzPipeListener.__init__�su��#�D�M�"&�"2�"2��"2�">�">�!?�D��"&�D���N�=�t�}�M�M�M����l�:��(�$�-�8�q����D�J�J�JrFc
�.�tjtjz}|r|tjz}tj|j|tjtjztjztj	tttjtj��Sr)
r�rr r!rrr"r#r$�PIPE_UNLIMITED_INSTANCESrr%r&)rErM�flagss   rrNzPipeListener._new_handle�sp���.��1M�M�E��
?���>�>���*��
�u��)�G�,I�I��!�"��0�'�7��,�g�l���
rc�D�|j�|�����|j�d��}	t	j|d���}	t	j|jgdt��}n.#|�	��t	j
|���xYw	|�d��\}}nJ#|�d��\}}wxYw#t$r }|j
tjkr�Yd}~nd}~wwxYwt|��S)NrTr�F)rO�appendrN�popr�r*r�r�rr�r�r�rQr��
ERROR_NO_DATAr�)rErFr��resr1r�r�s       rr�zPipeListener.accept�s8����%�%�d�&6�&6�&8�&8�9�9�9��'�+�+�A�.�.�F�
$��-�f��F�F�F��	$�!�8���
�E�8�5�5�C�C����I�I�K�K�K��'��/�/�/������ �3�3�D�9�9�F�A�s�s��R�3�3�D�9�9�F�A�s�#�O�O�O���
�
�
��:��!6�6�6��7�6�6�6�6�����
���� "�&�)�)�)s6�C&�!B�C	�+B,�,C	�	C#�&
D�0D�Dc�b�tjd|��|D]}tj|���dS)Nz closing listener with address=%r)rrPr�r�)�queuer<rFs   rrQz$PipeListener._finalize_pipe_listener�sB���N�=�w�G�G�G��
,�
,���#�F�+�+�+�+�
,�
,rr)F)	r�r�r�r�rIrNr��staticmethodrQr�rrr�r��sp������	�	�		�		�		�		�
	�
	�
	�
	�	*�	*�	*�.
�	,�	,�
��	,�	,�	,rr�c	���t��}		tj|d��tj|tjtjzdtjtjtjtj��}nG#t$r9}|j
tjtjfvst|��r�Yd}~nd}~wwxYw��tj|tjdd��t!|��S)zU
        Return a connection object connected to the pipe given by `address`
        r��rN)rr��
WaitNamedPiper'rrr&r(r rQr��ERROR_SEM_TIMEOUT�ERROR_PIPE_BUSYrr)r#r�)r<r�hr�s    rrr�s��
�O�O��	�
��%�g�t�4�4�4��&��W�1�G�4I�I��w�|�W�%:��0�'�,�������
�
�
��:�g�&?�&-�&=�&?�?�?�BP�QR�BS�BS�?��?�?�?�?�?�����
����	�"	�'�
�w�,�d�D�	�	�	��a� � � s�A.B�
C�
/B>�>C�s#CHALLENGE#s	#WELCOME#s	#FAILURE#c��ddl}t|t��s/td�t|�������t
jt��}|�	t|z��|�||d�����}|�
d��}||kr|�	t��dS|�	t��t!d���)Nr� Authkey must be bytes, not {0!s}�md5�zdigest received was wrong)�hmacr�r�r,�formatr7r(�urandom�MESSAGE_LENGTHro�	CHALLENGE�new�digestrz�WELCOME�FAILUREr	��
connectionr�rh�messagern�responses      rr�r��s����K�K�K��g�u�%�%�F��.�5�5�d�7�m�m�D�D�F�F�	F��j��(�(�G����)�g�-�.�.�.�
�X�X�g�w��
.�
.�
5�
5�
7�
7�F��$�$�S�)�)�H��6������g�&�&�&�&�&����g�&�&�&�!�"=�>�>�>rc���ddl}t|t��s/td�t|�������|�d��}|tt��d�}|�	||d���
��}|�|��|�d��}|tkrtd���dS)Nrrergrfzdigest sent was rejected)rhr�r�r,rir7rzr|rlrmrnroror	rqs      rr�r��s����K�K�K��g�u�%�%�F��.�5�5�d�7�m�m�D�D�F�F�	F��#�#�C�(�(�G��c�)�n�n�o�o�&�G�
�X�X�g�w��
.�
.�
5�
5�
7�
7�F����&�!�!�!��$�$�S�)�)�H��7���!�"<�=�=�=��rc� �eZdZd�Zd�Zd�ZdS)�ConnectionWrapperc�|�||_||_||_dD]#}t||��}t	|||���$dS)N)rarXr�rzro)�_conn�_dumps�_loadsr8�setattr)rE�connrrr��attrrts      rrIzConnectionWrapper.__init__sT����
�������K�	%�	%�D��$��%�%�C��D�$��$�$�$�$�	%�	%rc�d�|�|��}|j�|��dSr)rzryro)rErtrGs   rruzConnectionWrapper.sends/���K�K������
���a� � � � � rc�^�|j���}|�|��Sr)ryrzr{rFs  rr�zConnectionWrapper.recvs%���J�!�!�#�#���{�{�1�~�~�rN)r�r�r�rIrur�r�rrrwrwsA������%�%�%�!�!�!�����rrwc�f�t�|fdddd���d��S)Nr�utf-8)�	xmlrpclibrr�encode)rts r�
_xml_dumpsr�s,���?�?�C�6�4��t�Q�7�7�>�>�w�G�G�Grc�j�t�|�d����\\}}|S)Nr�)r�r��decode)rGrt�methods   r�
_xml_loadsr� s*���_�_�Q�X�X�g�%6�%6�7�7�N�F�S�F��Jrc��eZdZd�ZdS)�XmlListenerc�x�ddlmat�|��}t|tt��S�Nr)�
xmlrpc.client�clientr�rr�rwr�r�rss  rr�zXmlListener.accept%s7��)�)�)�)�)�)��o�o�d�#�#�� ��j�*�=�=�=rN)r�r�r�r�r�rrr�r�$s#������>�>�>�>�>rr�c�X�ddlmatt	|i|��t
t��Sr�)r�r�r�rwrr�r�)r6�kwdss  r�	XmlClientr�+s3��%�%�%�%�%�%��V�T�2�T�2�2�J�
�K�K�Krc��t|��}g}|r�tj|d|��}|tkrn�t|cxkrtt|��zkrnn|tz}nDt|cxkrtt|��zkrnn|tz}ntd���|�||��||dzd�}d}|��|S)NFzShould not get hererr)	�listr�r�rrr|r
r�rV)�handlesr�L�readyrYs     r�_exhaustive_waitr�6s���
��M�M�����	��0��E�7�C�C�C��l�"�"���#�>�>�>�>�
��A���(>�>�>�>�>�>��}�$���!�S�D�D�D�D�+;�c�!�f�f�+D�D�D�D�D�D��'�'���"�#8�9�9�9��L�L��3�� � � ��#�a�%�&�&�	�A��G��	��rc��
��|�t}n|dkrd}nt|dzdz��}t|��}i�g}t���
t��}	|D�]B}	t	|d��}	tj|��dd��\}}n*#t$r}d|j}}|tvr�Yd}~nd}~wwxYw|t
j
kr |�|��|�|j<��|rptj��dd�dkrQ	|�d	��\}	}n#t$r}|j}Yd}~nd}~wwxYw|st!|d
��rd|_�
�|��d}��#t&$r|�|���<Y��@wxYwt+����|��}|D]}|����|D]�}	|�d��\}	}n(#t$r}|j}|tvr�Yd}~nd}~wwxYw|t
jkr?�|j}�
�|��|dkrt!|d
��rd|_��n�#|D]}|����|D]�}	|�d��\}	}n(#t$r}|j}|tvr�Yd}~nd}~wwxYw|t
jkr?�|j}�
�|��|dkrt!|d
��rd|_��wxYw�
��fd�|D�����
fd�|D��S)
��
        Wait till an object in object_list is ready/readable.

        Returns list of those objects in object_list which are ready/readable.
        Nrr^g�?raT�)�r�Fr�c3�(�K�|]}�|V��
dSrr�)�.0rb�waithandle_to_objs  �r�	<genexpr>zwait.<locals>.<genexpr>�s)�����I�I�a�.�q�1�I�I�I�I�I�Irc���g|]}|�v�|��	Sr�r�)r��o�
ready_objectss  �r�
<listcomp>zwait.<locals>.<listcomp>�s#���=�=�=�a�!�}�*<�*<��*<�*<�*<r)r�intr��setr8r�r�rQr��
_ready_errorsr�rVr�r1�getwindowsversionr�r3r��add�AttributeErrorrAr��keysr�r��update)�object_listr�ov_list�
ready_handlesr�rar�r�r�r1r�r�s          @@rrrLsX�����?��G�G�
�q�[�[��G�G��'�D�.�3�.�/�/�G��;�'�'���������
����
�6	8� �
$�
$��$�$�Q��1�1�F�
"�")�"2�6�6�8�8�Q��"E�"E���C�C��"�"�"�"�"&��
�C���m�3�3�!�4�3�3�3�3�����"�����g�6�6�6����r�*�*�*�67�)�"�(�3�3�
�<�#�"7�"9�"9�"�1�"�"=��"G�"G�1�)+�)?�)?��)F�)F���3�3��#*�1�1�1�&'�j�����������1����#&�<�7�1�6J�+K�+K�<�7;�� 4�%�)�)�!�,�,�,�"#����7&�9�9�9�78�%�a�k�k�m�m�4�4�4�9����:-�->�-C�-C�-E�-E�w�O�O�M��
�
���	�	������
8�
8����3�3�D�9�9�F�A�s�s�������*�C��-�/�/��0�/�/�/�/����������'�9�9�9�)�"�(�3�A�!�%�%�a�(�(�(��a�x�x�#�1�&:�;�;�8�37�A�0��
8��	�
�
���	�	������
8�
8����3�3�D�9�9�F�A�s�s�������*�C��-�/�/��0�/�/�/�/����������'�9�9�9�)�"�(�3�A�!�%�%�a�(�(�(��a�x�x�#�1�&:�;�;�8�37�A�0��
8���� 	���I�I�I�I�=�I�I�I�I�I�I�=�=�=�=�;�=�=�=�=s��I3�!E9�2!B�I3�
B;�B6�1I3�6B;�;AI3�D)�(I3�)
E�3D?�:I3�?E�5I3�9!F�I3�F�%I3�!G:�:
H�H�H�3L$�J+�*L$�+
K	�5K	�L$�K	�AL$�PollSelectorc�n�t��5}|D]"}|�|tj���#|�t	j��|z}	|�|��}|rd�|D��cddd��S|�*|t	j��z
}|dkr|cddd��S�\#1swxYwYdS)r�NTc�"�g|]\}}|j��
Sr�)�fileobj)r��key�eventss   rr�zwait.<locals>.<listcomp>�s��C�C�C�M�S�&�C�K�C�C�Crr)�
_WaitSelector�register�	selectors�
EVENT_READrr�select)r�r�selectorrt�deadliner�s      rrr�s4���_�_�	)��"�
=�
=���!�!�#�y�';�<�<�<�<��"��>�+�+�g�5��
)� ����0�0���)�C�C�U�C�C�C�	)�	)�	)�	)�	)�	)�	)�	)��*�"*�T�^�-=�-=�"=��"�Q�;�;�#(�	)�	)�	)�	)�	)�	)�	)�	)�
)�	)�	)�	)�	)����	)�	)�	)�	)�	)�	)s�A!B*�=B*�)B*�*B.�1B.c��|���}tj|tjtj��5}ddlm}|�|��}t||j	|j
ffcddd��S#1swxYwYdS)Nr)�resource_sharer)rar4�fromfdr�SOCK_STREAMr$r��	DupSocket�rebuild_connectionrGrH)r}rFrGr��dss     r�reduce_connectionr��s���������
�]�6�6�>�6�3E�
F�
F�	J�!�)�)�)�)�)�)� �*�*�1�-�-�B�%��D�M�4�=�'I�I�	J�	J�	J�	J�	J�	J�	J�	J�	J�	J�	J�	J����	J�	J�	J�	J�	J�	Js�1A=�=B�Bc�p�|���}t|���||��Sr�rr�)r�rGrH�socks    rr�r��s)���y�y�{�{���$�+�+�-�-��8�<�<�<rc���|jrtjnd|jrtjndz}tj|���|��}t||j|jffSr�)	rGr��FILE_GENERIC_READrH�FILE_GENERIC_WRITEr�	DupHandlera�rebuild_pipe_connection)r}r,�dhs   r�reduce_pipe_connectionr��s^��04�
�D�7�,�,�1�15��E�7�-�-�A�G��
�
 �������
7�
7��&��T�]�D�M�(J�J�Jrc�L�|���}t|||��Sr)rr�)r�rGrHrFs    rr�r��s!���������f�h��9�9�9rc�z�tj|�����}t||j|jffSr)r�DupFdrar�rGrH)r}�dfs  rr�r��s/��
�_�T�[�[�]�]�
+�
+��!�B��
�t�}�#E�E�Erc�L�|���}t|||��Srr�)r�rGrH�fds    rr�r��s!��
�Y�Y�[�[���"�h��1�1�1r)NN)Tr)J�__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�rrkrlrorpr�r�rwr�r�r�r�r�r��ERROR_NETNAME_DELETEDr�rr�r�r��SelectSelectorr�r�r�r�r�r�rr�<module>r�s���3�
2�
2������	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�
�
�
�
�����������������������1�1�1�1�1�1�1�1��������*����N�N�N�O�O�O�O�O�O�O�O�O�O�O�O�O������
�|�w���
��G�G�G����������	��!�!�
����;��
�7�6�9�����N�����H��<�7����N�����H�-�&�&�&�&� � � �0�0�0�
F�
F�
F�
F�
F�
F�&T�T�T�T�T�T�T�T�n�_�]�]�]�]�]��]�]�]�@M�M�M�M�M��M�M�M�h;�;�;�;�;�v�;�;�;�|
�
�
�
�*�<�7��������&&�&�&�&�X)�)�)�)�)�V�)�)�)�X&�&�&��<�7���6,�6,�6,�6,�6,�v�6,�6,�6,�p!�!�!�>���	�
��
��
?�
?�
?�>�>�>�$
�
�
�
�
��
�
�
�H�H�H����>�>�>�>�>�(�>�>�>�L�L�L��<�7������(�.��0M�N�M�L>�L>�L>�L>�L>�`����
�w�y�.�)�)�1�!�.�
�
�!�0�
�)�)�)�)�6�<�7���J�J�J�=�=�=��I��z�#4�5�5�5�K�K�K�
:�:�:��I��~�'=�>�>�>�>�>�F�F�F�2�2�2��I��z�#4�5�5�5�5�5s�	A�A0�/A0