%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/zmq/auth/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/zmq/auth/thread.pyo

�
+�{Wc@s�dZddlZddlZddlmZmZddlZddlmZddl	m
Z
mZmZm
Z
ddlmZdefd	��YZd
�Zedefd��Y�ZdgZdS(
s>ZAP Authenticator in a Python Thread.

.. versionadded:: 14.1
i����N(tThreadtEvent(tjsonapi(tbytestunicodetbtui(t
AuthenticatortAuthenticationThreadcBs;eZdZdddd�Zd�Zd�Zd�ZRS(smA Thread for running a zmq Authenticator
    
    This is run in the background by ThreadedAuthenticator
    sutf-8c	Cs�tt|�j�|p%tjj�|_||_|pFtj	d�|_
}t�|_|pwt
|d|d|�|_|jtj�|_d|j_|jj|�dS(Nszmq.authtencodingtlogi(tsuperRt__init__tzmqtContexttinstancetcontextR	tloggingt	getLoggerR
RtstartedRt
authenticatortsockettPAIRtpipetlingertconnect(tselfRtendpointR	R
R((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyRs	!cCs|jj�|jj�|jj}tj�}|j|jtj	�|j|tj	�x�t
r�yt|j��}Wntj
k
r�PnX|j|kr�||jtj	kr�|j�}|r�Pq�n||kr^||tj	kr^|j�q^q^W|jj�|jj�dS(s*Start the Authentication Agent thread taskN(RtstartRtsett
zap_socketR
tPollertregisterRtPOLLINtTruetdicttpolltZMQErrort_handle_pipet_handle_zaptclosetstop(Rtzaptpollertsockst	terminate((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pytrun&s&

	%
cCs0|jjj�}|sdS|jj|�dS(s7
        Handle a message from the ZAP socket.
        N(RRtrecv_multipartthandle_zap_message(Rtmsg((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR'?sc
Cs�t}|jj�}|d
kr+t}|S|d}|jjd|�|dkr�g|dD]}t||j�^q_}y|j	j
|�Wq�tk
r�}|jjd|�q�Xn6|dkr2g|dD]}t||j�^q�}y|j	j
|�Wq�tk
r.}|jjd|�q�Xn�|dkr}t|d|j�}|d	}|j	j|tj|��nv|d
kr�t|d|j�}t|d	|j�}	|j	j||	�n(|dkr�t}n|jjd|�|S(s6
        Handle a message from front-end API.
        isauth received API command %rtALLOWisFailed to allow %stDENYsFailed to deny %stPLAINitCURVEt	TERMINATEs!Invalid auth command from API: %rN(tFalseRR/tNoneR"R
tdebugRR	Rtallowt	Exceptiont	exceptiontdenytconfigure_plainRtloadstconfigure_curveterror(
RR-R1tcommandtmt	addressestetdomaintjson_passwordstlocation((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR&Gs>
))
	N(t__name__t
__module__t__doc__R8RR.R'R&(((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyRs

		cCscx\|jj�D]K\}}|jd�r1qntt|d�}|js|j|_qqW|S(sAinherit docstrings from Authenticator, so we don't duplicate themt_N(t__dict__titemst
startswithtgetattrRR8RK(tclstnametmethodtupstream_method((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt_inherit_docstrings{s	tThreadAuthenticatorcBsteZdZd
dd
d�Zd�Zd�Zdd
d�Zddd�Zd	�Z	d
�Z
d�Zd�ZRS(s-Run ZAP authentication in a background threadsutf-8cCsX|ptjj�|_||_||_d|_djt	|��|_
d|_dS(Nsinproc://{0}.inproc(R
RRRR
R	R8Rtformattidt
pipe_endpointtthread(RRR	R
((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR�s			cGs:|jjdgg|D]}t||j�^q�dS(NR2(Rtsend_multipartRR	(RRDta((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR:�scGs:|jjdgg|D]}t||j�^q�dS(NR3(RR[RR	(RRDR\((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR=�st*cCs8|jjdt||j�tj|p*i�g�dS(NR4(RR[RR	Rtdumps(RRFt	passwords((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR>�stcCsAt||j�}t||j�}|jjd||g�dS(NR5(RR	RR[(RRFRH((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR@�scCs�|jjtj�|_d|j_|jj|j�t|j|jd|j	d|j
�|_|jj�|jj
jdd�s�td��ndS(sStart the authentication threadiR	R
ttimeouti
s$Authenticator thread failed to startN(RRR
RRRtbindRYRR	R
RZRRtwaittRuntimeError(R((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR�s*
cCs[|jrW|jjd�|j�r5|jj�nd|_|jj�d|_ndS(sStop the authentication threadR6N(Rtsendtis_aliveRZtjoinR8R((R((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR)�s		
cCs |jr|jj�rtStS(s$Is the ZAP thread currently running?(RZRfR"R7(R((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyRf�scCs|j�dS(N(R)(R((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt__del__�sN(
RIRJRKR8RR:R=R>R@RR)RfRh(((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyRV�s				
	(RKttimeRt	threadingRRR
t	zmq.utilsRtzmq.utils.strtypesRRRRtbaseRRRUtobjectRVt__all__(((s5/usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt<module>s"h	
7

Zerion Mini Shell 1.0