diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-02-19 14:12:15 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-02-20 14:23:05 -0300 |
commit | 00b8cbaa31d48326b36928228269ac14276fd5ee (patch) | |
tree | b01d1b66bc933815104ee73b1805c1ef00d17e14 /src/leap/bitmask/backend/signaler_qt.py | |
parent | ff705af455af17710bab34c7959f1c54fb963839 (diff) |
Fall back to plain ZMQ if Curve is not available.
Use global flag for ZMQ_HAS_CURVE.
Closes #6646
Diffstat (limited to 'src/leap/bitmask/backend/signaler_qt.py')
-rw-r--r-- | src/leap/bitmask/backend/signaler_qt.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/leap/bitmask/backend/signaler_qt.py b/src/leap/bitmask/backend/signaler_qt.py index 433f18ed..94c24648 100644 --- a/src/leap/bitmask/backend/signaler_qt.py +++ b/src/leap/bitmask/backend/signaler_qt.py @@ -24,10 +24,14 @@ import time from PySide import QtCore import zmq -from zmq.auth.thread import ThreadAuthenticator +try: + from zmq.auth.thread import ThreadAuthenticator +except ImportError: + pass from leap.bitmask.backend.api import SIGNALS from leap.bitmask.backend.utils import get_frontend_certificates +from leap.bitmask.config import flags import logging logger = logging.getLogger(__name__) @@ -67,17 +71,18 @@ class SignalerQt(QtCore.QObject): context = zmq.Context() socket = context.socket(zmq.REP) - # Start an authenticator for this context. - auth = ThreadAuthenticator(context) - auth.start() - auth.allow('127.0.0.1') - - # Tell authenticator to use the certificate in a directory - auth.configure_curve(domain='*', location=zmq.auth.CURVE_ALLOW_ANY) - public, secret = get_frontend_certificates() - socket.curve_publickey = public - socket.curve_secretkey = secret - socket.curve_server = True # must come before bind + if flags.ZMQ_HAS_CURVE: + # Start an authenticator for this context. + auth = ThreadAuthenticator(context) + auth.start() + auth.allow('127.0.0.1') + + # Tell authenticator to use the certificate in a directory + auth.configure_curve(domain='*', location=zmq.auth.CURVE_ALLOW_ANY) + public, secret = get_frontend_certificates() + socket.curve_publickey = public + socket.curve_secretkey = secret + socket.curve_server = True # must come before bind socket.bind(self.BIND_ADDR) |