Your IP : 216.73.217.17


Current Path : /lib/python2.7/site-packages/pyzor/
Upload File :
Current File : //lib/python2.7/site-packages/pyzor/forwarder.pyc

�
�}Iec@shdZddlZddlZyddlZWnek
rMddlZnXdefd��YZdS(sManage the forwarder process.i����Nt	ForwardercBsAeZdZdd�Zd�Zed�Zd�Zd�ZRS(s'Forwards digest to remote pyzor serversi'cCs:tjd�|_||_tj|�|_||_dS(s
        forward_client: a pyzor.client.Client instance to use as
                        forwarding client
        remote_servers: a list of (hostname,port) tuples where digests should
                        be forwarded to
        max_queue_size: max amount of queued digests
        tpyzordN(tloggingt	getLoggertlogtforwarding_clienttQueuet
forward_queuetremote_servers(tselfRRtmax_queue_size((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pyt__init__s		cCs�x�tr�y%|jjdtdd�\}}Wn*tjk
rZ|jdkrdSqnXxs|jD]h}y3|r�|jj||�n|jj	||�Wqet
k
r�}|jjd|||�qeXqeWqWdS(s'read forwarding requests from the queuetblockttimeoutiNs%Forwarding digest %s to %s failed: %s(
tTrueRtgetRtEmptyRtNoneRt	whitelisttreportt	ExceptionRtwarn(R	tdigestRtservertex((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pyt
_forward_loops 	cCsH|jdkrdSy|jj||f�Wntjk
rCnXdS(s�If forwarding is enabled, insert a digest into the forwarding queue
        if whitelist is True, the digest will be forwarded as whitelist request
        if the queue is full, the digest is dropped
        N(RRRt
put_nowaitRtFull(R	RR((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pytqueue_forward_request5scCstjd|j�j�dS(sstart the forwarding threadttargetN(t	threadingtThreadRtstart(R	((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pytstart_forwardingBscCs
d|_dS(s?disable forwarding and tell the forwarding thread to end itselfN(RR(R	((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pytstop_forwardingFs(	t__name__t
__module__t__doc__RRtFalseRR!R"(((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pyRs
	
	(R%RRRtImportErrortqueuetobjectR(((s3/usr/lib/python2.7/site-packages/pyzor/forwarder.pyt<module>s