diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-03-21 12:55:37 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2016-03-21 12:55:37 +0200 |
commit | 14b94326315f1fa46187868dac16503b3f454b9e (patch) | |
tree | b1fa98d5d8ebabd3256d691d47944b763684fae9 /scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/auth/ioloop.py | |
parent | 1831e9bbc03484b078dbd604dfec0e025cea8eca (diff) | |
parent | bd933929deb40243e4fb218ec2c5b33a12a6e02a (diff) |
Merge Scapy 3.0
Diffstat (limited to 'scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/auth/ioloop.py')
-rw-r--r-- | scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/auth/ioloop.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/auth/ioloop.py b/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/auth/ioloop.py new file mode 100644 index 00000000..1f448b47 --- /dev/null +++ b/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/auth/ioloop.py @@ -0,0 +1,34 @@ +"""ZAP Authenticator integrated with the tornado IOLoop. + +.. versionadded:: 14.1 +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from zmq.eventloop import ioloop, zmqstream +from .base import Authenticator + + +class IOLoopAuthenticator(Authenticator): + """ZAP authentication for use in the tornado IOLoop""" + + def __init__(self, context=None, encoding='utf-8', log=None, io_loop=None): + super(IOLoopAuthenticator, self).__init__(context) + self.zap_stream = None + self.io_loop = io_loop or ioloop.IOLoop.instance() + + def start(self): + """Start ZAP authentication""" + super(IOLoopAuthenticator, self).start() + self.zap_stream = zmqstream.ZMQStream(self.zap_socket, self.io_loop) + self.zap_stream.on_recv(self.handle_zap_message) + + def stop(self): + """Stop ZAP authentication""" + if self.zap_stream: + self.zap_stream.close() + self.zap_stream = None + super(IOLoopAuthenticator, self).stop() + +__all__ = ['IOLoopAuthenticator'] |