diff options
author | Kali Kaneko <kali@leap.se> | 2015-11-02 16:23:49 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-11-02 16:50:56 -0400 |
commit | 6114dd95c6c33d352e705eb182d32e90e288e338 (patch) | |
tree | 38e8f2c5bad650858584481555aff233201ea5d8 /src/leap | |
parent | b99a73844671dcee54fee2bd30dfa08bd6eb742d (diff) |
[cherry-pick] [bug] use embedded minitornado. Closes: #7562
using system tornado library raises a bug due to a mismatching
signature.
- Resolves: #7562
- Releases: 0.9.1
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/bitmask/backend/backend_proxy.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/leap/bitmask/backend/backend_proxy.py b/src/leap/bitmask/backend/backend_proxy.py index ae300b32..1f90657b 100644 --- a/src/leap/bitmask/backend/backend_proxy.py +++ b/src/leap/bitmask/backend/backend_proxy.py @@ -25,6 +25,7 @@ import threading import zmq from zmq.eventloop import ioloop +from zmq.eventloop.minitornado.ioloop import PollIOLoop from zmq.eventloop import zmqstream from leap.bitmask.backend.api import API, STOP_REQUEST, PING_REQUEST @@ -34,9 +35,20 @@ from leap.bitmask.backend.utils import get_backend_certificates from leap.bitmask.config import flags from leap.bitmask.logs.utils import get_logger + logger = get_logger() +class _ZMQIOLoop(ioloop.ZMQIOLoop): + """ + Returns a global ``IOLoop`` instance, but forcing the use of the embedded + minitornado. + """ + @staticmethod + def instance(): + return PollIOLoop.instance() + + class ZmqREQConnection(threading.Thread): """ A threaded zmq req connection. @@ -67,7 +79,7 @@ class ZmqREQConnection(threading.Thread): socket = context.socket(zmq.REQ) # we use zmq's eventloop in order to asynchronously send requests - loop = ioloop.ZMQIOLoop.current() + loop = _ZMQIOLoop.instance() self._stream = zmqstream.ZMQStream(socket, loop) if flags.ZMQ_HAS_CURVE: |