summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/backend_app.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2015-07-26 15:37:51 +0200
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-08-05 15:38:00 -0300
commit37a86b18242ccd27db41254e2f51b05b05509c8a (patch)
treec5c8762e1dc4accb1588deea5811d15d7b50efdc /src/leap/bitmask/backend_app.py
parenta119c4ba82daedcea571950ce6f2e8b09289e5fa (diff)
[feat] Move the updater code from the launcher
The new pyinstaller method will rule out the launcher, we need the updater working inside bitmask client. - Closes: #7291
Diffstat (limited to 'src/leap/bitmask/backend_app.py')
-rw-r--r--src/leap/bitmask/backend_app.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/leap/bitmask/backend_app.py b/src/leap/bitmask/backend_app.py
index 1040fbf8..dcd08d97 100644
--- a/src/leap/bitmask/backend_app.py
+++ b/src/leap/bitmask/backend_app.py
@@ -20,6 +20,8 @@ Start point for the Backend.
import multiprocessing
import signal
+from twisted.internet import reactor
+
from leap.common.events import server as event_server
from leap.bitmask.backend.leapbackend import LeapBackend
@@ -80,23 +82,24 @@ def run_backend(bypass_checks=False, flags_dict=None, frontend_pid=None):
if flags_dict is not None:
dict_to_flags(flags_dict)
- # HACK we should be able to run the ensure_server anyway but right now it
- # breaks if we run it twice.
- if not flags.STANDALONE:
- # start the events server
- # This is not needed for the standalone bundle since the launcher takes
- # care of it.
- try:
- from twisted.internet import reactor
- reactor.callWhenRunning(reactor.callLater, 0,
- event_server.ensure_server)
- except Exception as e:
- logger.error("Could not ensure server: %r" % (e,))
+ reactor.callWhenRunning(start_events_and_updater, logger)
backend = LeapBackend(bypass_checks=bypass_checks,
frontend_pid=frontend_pid)
backend.run()
+def start_events_and_updater(logger):
+ event_server.ensure_server()
+
+ if flags.STANDALONE:
+ try:
+ from leap.bitmask.updater import Updater
+ updater = Updater()
+ updater.start()
+ except ImportError:
+ logger.error("Updates are not enabled in this distribution.")
+
+
if __name__ == '__main__':
run_backend()