Current File : //opt/imh-python/lib/python2.7/multiprocessing/connection.pyc
�
��Wc@sydddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZmZddlmZmZdZd	Zej�Zd
Zd
gZeed�r	dZedg7Znejdkr.d
Zed
g7Zned�Zd�Zd�Zd�Zde fd��YZ!ddd�Z#ejdkr�e$d�Z%nddlm&Z&e$d�Z%de fd��YZ'd�Z(ejdkrde fd��YZ)d�Z*ndZ+dZ,dZ-d Z.d!�Z/d"�Z0d#e fd$��YZ1d%�Z2d&�Z3d'e!fd(��YZ4d)�Z5dS(*tClienttListenertPipei����N(tcurrent_processtAuthenticationError(tget_temp_dirtFinalizet	sub_debugtdebug(t	duplicatetclosei g4@tAF_INETtAF_UNIXtwin32tAF_PIPEcCstj�|S(N(ttime(ttimeout((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt
_init_timeoutIscCstj�|kS(N(R(tt((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt_check_timeoutLscCs}|dkrd
S|dkr5tjdddt��S|dkrmtjdd	tj�tj�fdd
�Std��dS(s?
    Return an arbitrary free address for the given family
    Rt	localhostiRtprefixs	listener-tdirRs\\.\pipe\pyc-%d-%d-tsunrecognized familyN(Ri(ttempfiletmktempRtostgetpidt
_mmap_countertnextt
ValueError(tfamily((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pytarbitrary_addressSs cCset|�tkrdSt|�tkr;|jd�r;dSt|�tkrQdStd|��dS(s]
    Return the types of the address

    This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
    Rs\\RRsaddress type of %r unrecognizedN(ttypettupletstrt
startswithR(taddress((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pytaddress_typebs!cBsSeZdZddddd�Zd�Zd�Zed��Zed��Z	RS(s�
    Returns a listener object.

    This is a wrapper for a bound socket which is 'listening' for
    connections, or for a Windows named pipe.
    icCs�|p|rt|�pt}|p-t|�}|dkrQt||�|_nt|||�|_|dk	r�t|t�r�t	d�n||_
dS(NRsauthkey should be a byte string(R&tdefault_familyR tPipeListenert	_listenertSocketListenertNonet
isinstancetbytest	TypeErrort_authkey(tselfR%Rtbacklogtauthkey((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt__init__|scCs?|jj�}|jr;t||j�t||j�n|S(sz
        Accept a connection on the bound socket or named pipe of `self`.

        Returns a `Connection` object.
        (R)tacceptR/tdeliver_challengetanswer_challenge(R0tc((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR4�s
	cCs
|jj�S(sA
        Close the bound socket or named pipe of `self`.
        (R)R
(R0((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR
�scCs
|jjS(N(R)t_address(R0((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt<lambda>�scCs
|jjS(N(R)t_last_accepted(R0((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR9�sN(
t__name__t
__module__t__doc__R+R3R4R
tpropertyR%t
last_accepted(((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyRus		cCs�|pt|�}|dkr-t|�}nt|�}|dk	rat|t�ratd�n|dk	r�t||�t||�n|S(s=
    Returns a connection to the address of a `Listener`
    Rsauthkey should be a byte stringN(	R&t
PipeClienttSocketClientR+R,R-R.R6R5(R%RR2R7((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR�s
cCs�|r�tj�\}}|jt�|jt�tjtj|j���}tjtj|j���}|j	�|j	�n<tj
�\}}tj|dt�}tj|dt�}||fS(sL
        Returns pair of connection objects at either end of a pipe
        twritabletreadable(tsockett
socketpairtsetblockingtTruet_multiprocessingt
ConnectionRtduptfilenoR
tpipetFalse(tduplexts1ts2tc1tc2tfd1tfd2((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR�s



(R
c	CsUtd�}|r;tj}tjtjB}tt}}ntj}tj}dt}}tj||tjtj	Btj
Bd||tjtj�}tj
||dtjtjdtj�}tj|tj	dd�ytj|tj�Wn/tk
r }|jdtjkr!�q!nXtj|d|�}	tj|d|�}
|	|
fS(sL
        Returns pair of connection objects at either end of a pipe
        RiiRBRCN(R R
tPIPE_ACCESS_DUPLEXtGENERIC_READt
GENERIC_WRITEtBUFSIZEtPIPE_ACCESS_INBOUNDtCreateNamedPipetPIPE_TYPE_MESSAGEtPIPE_READMODE_MESSAGEt	PIPE_WAITtNMPWAIT_WAIT_FOREVERtNULLt
CreateFilet
OPEN_EXISTINGtSetNamedPipeHandleStateR+tConnectNamedPipetWindowsErrortargstERROR_PIPE_CONNECTEDRHtPipeConnection(RNR%topenmodetaccesstobsizetibsizeth1th2teRQRR((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR�s2			

$
R*cBs,eZdZdd�Zd�Zd�ZRS(sO
    Representation of a socket which is bound to an address and listening
    icCs�tjtt|��|_yb|jjtjtjd�|jjt�|jj|�|jj	|�|jj
�|_Wn$tjk
r�|jj
��nX||_d|_|dkr�t|tjd|fdd�|_n	d|_dS(NiRRetexitpriorityi(RDtgetattrt_sockett
setsockoptt
SOL_SOCKETtSO_REUSEADDRRFRGtbindtlistentgetsocknameR8terrorR
t_familyR+R:RRtunlinkt_unlink(R0R%RR1((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR3�s 
		$cCs�x\tr^y|jj�\}|_Wn2tjk
rY}|jdtjkr[�q[qXPqW|j	t�t
|j��}tj
|�}|j�|S(Ni(RGRqR4R:RDRxReterrnotEINTRRFR	RKRHRIR
(R0tsRntfdtconn((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR4s	


cCsAz|jj�Wd|j}|dk	r<d|_|�nXdS(N(RqR
R{R+(R0Rz((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR
s		(R;R<R=R3R4R
(((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR*�s	cCs�ttt|��}t�}x�tj|�}|jt�y|j|�Wnbtjk
r�}|j�|j	dt
jks�t|�r�t
d|��ntjd�q!XPq!W�t|j��}tj|�}|j�|S(sO
    Return a connection object connected to the socket given by `address`
    isfailed to connect to address %sg{�G�z�?(RpRDR&RRFRGtconnectRxR
ReR|tECONNREFUSEDRRRtsleepR	RKRHRI(R%RRR~RnRR�((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyRA)s&	

"

R(cBs2eZdZdd�Zd�Zed��ZRS(s0
        Representation of a named pipe
        c	Cs�||_tj|tjtjtjBtjBtjtttj	tj
�}|g|_d|_
td|j�t|tjd|j|jfdd�|_dS(Ns listener created with address=%rReRoi(R8R
RZRUR[R\R]tPIPE_UNLIMITED_INSTANCESRXR^R_t
_handle_queueR+R:RRR(t_finalize_pipe_listenerR
(R0R%R1thandle((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR3Os		
	c	Cs�tj|jtjtjtjBtjBtjtttj	tj
�}|jj|�|jj
d�}ytj|tj
�Wn8tk
r�}|jdtjtjfkr��q�nXtj|�S(Ni(R
RZR8RUR[R\R]R�RXR^R_R�tappendtpopRcRdReRft
ERROR_NO_DATARHRg(R0t	newhandleR�Rn((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR4bs

cCs,td|�x|D]}t|�qWdS(Ns closing listener with address=%r(RR
(tqueueR%R�((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR�vs

N(R;R<R=R+R3R4tstaticmethodR�(((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR(Ks	cCs�t�}x�yHtj|d�tj|tjtjBdtjtjdtj�}WnDtk
r�}|j	dtj
tjfks�t|�r��q�qXPqW�tj
|tjdd�tj|�S(sU
        Return a connection object connected to the pipe given by `address`
        i�iN(RR
t
WaitNamedPipeR`RVRWR_RaRdRetERROR_SEM_TIMEOUTtERROR_PIPE_BUSYRRbR\R+RHRg(R%RthRn((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR@|s 	"
is#CHALLENGE#s	#WELCOME#s	#FAILURE#cCs�ddl}t|t�s!t�tjt�}|jt|�|j	||�j
�}|jd�}||kr�|jt�n|jt
�td��dS(Ni����isdigest received was wrong(thmacR,R-tAssertionErrorRturandomtMESSAGE_LENGTHt
send_bytest	CHALLENGEtnewtdigestt
recv_bytestWELCOMEtFAILURER(t
connectionR2R�tmessageR�tresponse((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR5�s
cCs�ddl}t|t�s!t�|jd�}|tt� tksVtd|��|tt�}|j||�j�}|j	|�|jd�}|t
kr�td��ndS(Ni����ismessage = %rsdigest sent was rejected(R�R,R-R�R�tlenR�R�R�R�R�R(R�R2R�R�R�R�((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR6�s&
tConnectionWrappercBs#eZd�Zd�Zd�ZRS(cCsO||_||_||_x-dD]%}t||�}t|||�q"WdS(NRKR
tpollR�R�(sfilenoscloseR�s
recv_bytess
send_bytes(t_connt_dumpst_loadsRptsetattr(R0R�tdumpstloadstattrtobj((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR3�s			
cCs#|j|�}|jj|�dS(N(R�R�R�(R0R�R~((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pytsend�scCs|jj�}|j|�S(N(R�R�R�(R0R~((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pytrecv�s(R;R<R3R�R�(((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR��s		cCstj|fdddd�S(Ni(t	xmlrpclibR�R+(R�((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt
_xml_dumps�scCstj|�\\}}|S(N(R�R�(R~R�tmethod((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt
_xml_loads�stXmlListenercBseZd�ZRS(cCs+ddlatj|�}t|tt�S(Ni����(R�RR4R�R�R�(R0R�((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR4�s(R;R<R4(((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyR��scOs%ddlatt||�tt�S(Ni����(R�R�RR�R�(Retkwds((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt	XmlClient�s(6t__all__RtsysRDR|RRt	itertoolsRHtmultiprocessingRRtmultiprocessing.utilRRRRtmultiprocessing.forkingR	R
RXtCONNECTION_TIMEOUTtcountRR'tfamiliesthasattrtplatformRRR R&tobjectRR+RRGRR
R*RAR(R@R�R�R�R�R5R6R�R�R�R�R�(((ss/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/multiprocessing/connection.pyt<module>#s`"				,*2	 1