diff options
Diffstat (limited to 'src/leap/bitmask/app.py')
-rw-r--r-- | src/leap/bitmask/app.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 87f22d88..ef156671 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -44,6 +44,7 @@ import os import sys +from leap.bitmask.backend.backend_proxy import BackendProxy from leap.bitmask.backend.utils import generate_certificates from leap.bitmask import __version__ as VERSION @@ -178,19 +179,29 @@ def start_app(): logger.info('Starting app') - generate_certificates() + backend = BackendProxy() + backend_running = backend.check_online() - flags_dict = flags_to_dict() + logger.debug("Backend online: {0}".format(backend_running)) + + if not backend_running: + generate_certificates() - frontend_pid = os.getpid() - backend = lambda: run_backend(opts.danger, flags_dict, frontend_pid) - backend_process = multiprocessing.Process(target=backend, name='Backend') - # we don't set the 'daemon mode' since we need to start child processes in - # the backend - # backend_process.daemon = True - backend_process.start() + flags_dict = flags_to_dict() - run_frontend(options, flags_dict, backend_pid=backend_process.pid) + backend_pid = None + if not backend_running: + frontend_pid = os.getpid() + backend = lambda: run_backend(opts.danger, flags_dict, frontend_pid) + backend_process = multiprocessing.Process(target=backend, + name='Backend') + # we don't set the 'daemon mode' since we need to start child processes + # in the backend + # backend_process.daemon = True + backend_process.start() + backend_pid = backend_process.pid + + run_frontend(options, flags_dict, backend_pid=backend_pid) if __name__ == "__main__": |