7ec@sdddgZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z ddl m Z mZmZmZddlmZmZdZd Zd ZejZd Zd gZeed rd Zed g7Znejd kr4dZedg7ZnedZdZdZdZ de!fdYZ"dddZ$ejd kre%dZ&nddlm'Z'e%dZ&de!fdYZ(dZ)ejd kr de!fdYZ*dZ+ndZ,dZ-d Z.d!Z/d"Z0d#Z1d$Z2d%e!fd&YZ3d'Z4d(Z5d)e"fd*YZ6d+Z7dS(,tClienttListenertPipeiN(tcurrent_processtAuthenticationError(t get_temp_dirtFinalizet sub_debugtdebug(t duplicatetclosei g4@tsha256tAF_INETtAF_UNIXtwin32tAF_PIPEcCstj|S(N(ttime(ttimeout((s2/usr/lib64/python2.7/multiprocessing/connection.pyt _init_timeoutMscCstj|kS(N(R(tt((s2/usr/lib64/python2.7/multiprocessing/connection.pyt_check_timeoutPscCs}|dkrd S|dkr5tjdddtS|dkrmtjdd tjtjfdd Std d S(s? Return an arbitrary free address for the given family R t localhostiR tprefixs listener-tdirRs\\.\pipe\pyc-%d-%d-tsunrecognized familyN(Ri(ttempfiletmktempRtostgetpidt _mmap_countertnextt ValueError(tfamily((s2/usr/lib64/python2.7/multiprocessing/connection.pytarbitrary_addressWs     cCset|tkrdSt|tkr;|jdr;dSt|tkrQdStd|dS(s] Return the types of the address This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' R s\\RR saddress type of %r unrecognizedN(ttypettupletstrt startswithR(taddress((s2/usr/lib64/python2.7/multiprocessing/connection.pyt address_typefs!cBsSeZdZdddddZdZdZedZedZ 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 rt|t rt dn||_ dS(NRsauthkey should be a byte string( R'tdefault_familyR!t PipeListenert _listenertSocketListenertNonet isinstancetbytest TypeErrort_authkey(tselfR&R tbacklogtauthkey((s2/usr/lib64/python2.7/multiprocessing/connection.pyt__init__s  cCs?|jj}|jr;t||jt||jn|S(sz Accept a connection on the bound socket or named pipe of `self`. Returns a `Connection` object. (R*tacceptR0tdeliver_challengetanswer_challenge(R1tc((s2/usr/lib64/python2.7/multiprocessing/connection.pyR5s  cCs |jjS(sA Close the bound socket or named pipe of `self`. (R*R (R1((s2/usr/lib64/python2.7/multiprocessing/connection.pyR scCs |jjS(N(R*t_address(R1((s2/usr/lib64/python2.7/multiprocessing/connection.pytRcCs |jjS(N(R*t_last_accepted(R1((s2/usr/lib64/python2.7/multiprocessing/connection.pyR:RN( t__name__t __module__t__doc__R,R4R5R tpropertyR&t last_accepted(((s2/usr/lib64/python2.7/multiprocessing/connection.pyRys  cCs|pt|}|dkr-t|}n t|}|dk rat|t ratdn|dk rt||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/R7R6(R&R R3R8((s2/usr/lib64/python2.7/multiprocessing/connection.pyRs     cCs|rtj\}}|jt|jttjtj|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 socketpairt setblockingtTruet_multiprocessingt ConnectionRtduptfilenoR tpipetFalse(tduplexts1ts2tc1tc2tfd1tfd2((s2/usr/lib64/python2.7/multiprocessing/connection.pyRs    (Rc CsUtd}|r;tj}tjtjB}tt}}ntj}tj}dt}}tj||tjtj Btj Bd||tj tj }tj ||dtj tjdtj }tj|tj ddytj|tj Wn/tk r }|jdtjkr!q!nXtj|d|} tj|d|} | | fS(sL Returns pair of connection objects at either end of a pipe RiiRCRDN(R!RtPIPE_ACCESS_DUPLEXt GENERIC_READt GENERIC_WRITEtBUFSIZEtPIPE_ACCESS_INBOUNDtCreateNamedPipetPIPE_TYPE_MESSAGEtPIPE_READMODE_MESSAGEt PIPE_WAITtNMPWAIT_WAIT_FOREVERtNULLt CreateFilet OPEN_EXISTINGtSetNamedPipeHandleStateR,tConnectNamedPipet WindowsErrortargstERROR_PIPE_CONNECTEDRItPipeConnection( ROR&topenmodetaccesstobsizetibsizeth1th2teRRRS((s2/usr/lib64/python2.7/multiprocessing/connection.pyRs2      $ R+cBs,eZdZddZdZdZRS(sO Representation of a socket which is bound to an address and listening icCstjtt||_yb|jjtjtjd|jjt|jj||jj ||jj |_ Wn$tj k r|jj nX||_d|_|dkrt|tjd|fdd|_n d|_dS(NiR Rft exitpriorityi(REtgetattrt_sockett setsockoptt SOL_SOCKETt SO_REUSEADDRRGRHtbindtlistent getsocknameR9terrorR t_familyR,R;RRtunlinkt_unlink(R1R&R R2((s2/usr/lib64/python2.7/multiprocessing/connection.pyR4s     $cCsx\tr^y|jj\}|_Wn2tjk rY}|jdtjkr[q[qXPqW|j tt |j }t j |}|j|S(Ni(RHRrR5R;RERyRfterrnotEINTRRGR RLRIRJR (R1tsRotfdtconn((s2/usr/lib64/python2.7/multiprocessing/connection.pyR5s    cCsAz|jjWd|j}|dk r<d|_|nXdS(N(RrR R|R,(R1R{((s2/usr/lib64/python2.7/multiprocessing/connection.pyR #s    (R<R=R>R4R5R (((s2/usr/lib64/python2.7/multiprocessing/connection.pyR+s  cCsttt|}t}xtj|}|jty|j|Wnbtjk r}|j|j dt j kst |rt d|ntjdq!XPq!Wt|j}tj|}|j|S(sO Return a connection object connected to the socket given by `address` isfailed to connect to address %sg{Gz?(RqRER'RRGRHtconnectRyR RfR}t ECONNREFUSEDRRRtsleepR RLRIRJ(R&R RRRoRR((s2/usr/lib64/python2.7/multiprocessing/connection.pyRB-s&   "  R)cBs2eZdZddZdZedZRS(s0 Representation of a named pipe c Cs||_tj|tjtjtjBtjBtjtttj tj }|g|_ d|_ td|jt|tjd|j |jfdd|_dS(Ns listener created with address=%rRfRpi(R9RR[RVR\R]R^tPIPE_UNLIMITED_INSTANCESRYR_R`t _handle_queueR,R;RRR)t_finalize_pipe_listenerR (R1R&R2thandle((s2/usr/lib64/python2.7/multiprocessing/connection.pyR4Ss       c Cstj|jtjtjtjBtjBtjtttj tj }|j j ||j j d}ytj|tj Wn8tk r}|jdtjtjfkrqnXtj|S(Ni(RR[R9RVR\R]R^RRYR_R`RtappendtpopRdReRfRgt ERROR_NO_DATARIRh(R1t newhandleRRo((s2/usr/lib64/python2.7/multiprocessing/connection.pyR5fs    cCs,td|x|D]}t|qWdS(Ns closing listener with address=%r(RR (tqueueR&R((s2/usr/lib64/python2.7/multiprocessing/connection.pyRzs  N(R<R=R>R,R4R5t staticmethodR(((s2/usr/lib64/python2.7/multiprocessing/connection.pyR)Os  cCst}xyHtj|dtj|tjtjBdtjtjdtj}WnDtk r}|j dtj tj fkst |rqq XPq Wtj |tjddtj|S(sU Return a connection object connected to the pipe given by `address` iiN(RRt WaitNamedPipeRaRWRXR`RbReRftERROR_SEM_TIMEOUTtERROR_PIPE_BUSYRRcR]R,RIRh(R&RthRo((s2/usr/lib64/python2.7/multiprocessing/connection.pyRAs  " is #CHALLENGE#s #WELCOME#s #FAILURE#cCsddl}t|tS(Ni(thashlibRqtHMAC_DIGEST_NAME(R((s2/usr/lib64/python2.7/multiprocessing/connection.pytget_digestmod_for_hmacs cCsddl}t|ts!ttjt}|jt||j ||t j }|j d}||kr|jt n|jttddS(Niisdigest received was wrong(thmacR-R.tAssertionErrorRturandomtMESSAGE_LENGTHt send_bytest CHALLENGEtnewRtdigestt recv_bytestWELCOMEtFAILURER(t connectionR3RtmessageRtresponse((s2/usr/lib64/python2.7/multiprocessing/connection.pyR6s   cCsddl}t|ts!t|jd}|tt tksVtd||tt}|j||tj }|j ||jd}|t krt dndS(Niis message = %rsdigest sent was rejected( RR-R.RRtlenRRRRRRR(RR3RRRR((s2/usr/lib64/python2.7/multiprocessing/connection.pyR7s &  tConnectionWrappercBs#eZdZdZdZRS(cCsO||_||_||_x-dD]%}t||}t|||q"WdS(NRLR tpollRR(RLR RRR(t_connt_dumpst_loadsRqtsetattr(R1Rtdumpstloadstattrtobj((s2/usr/lib64/python2.7/multiprocessing/connection.pyR4s     cCs#|j|}|jj|dS(N(RRR(R1RR((s2/usr/lib64/python2.7/multiprocessing/connection.pytsendscCs|jj}|j|S(N(RRR(R1R((s2/usr/lib64/python2.7/multiprocessing/connection.pytrecvs(R<R=R4RR(((s2/usr/lib64/python2.7/multiprocessing/connection.pyRs  cCstj|fddddS(Ni(t xmlrpclibRR,(R((s2/usr/lib64/python2.7/multiprocessing/connection.pyt _xml_dumpsscCstj|\\}}|S(N(RR(RRtmethod((s2/usr/lib64/python2.7/multiprocessing/connection.pyt _xml_loadsst XmlListenercBseZdZRS(cCs+ddlatj|}t|ttS(Ni(RRR5RRR(R1R((s2/usr/lib64/python2.7/multiprocessing/connection.pyR5s (R<R=R5(((s2/usr/lib64/python2.7/multiprocessing/connection.pyRscOs%ddlatt||ttS(Ni(RRRRR(Rftkwds((s2/usr/lib64/python2.7/multiprocessing/connection.pyt XmlClients (8t__all__RtsysRER}RRt itertoolsRItmultiprocessingRRtmultiprocessing.utilRRRRtmultiprocessing.forkingR R RYtCONNECTION_TIMEOUTRtcountRR(tfamiliesthasattrtplatformRRR!R'tobjectRR,RRHRRR+RBR)RARRRRRR6R7RRRRR(((s2/usr/lib64/python2.7/multiprocessing/connection.pyt#sd        "      , *2 1