summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/backend_app.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-07-24 12:54:12 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-12-19 17:15:55 -0300
commitdf160c0d44e8d0439d54313f097b2a4d9ada7357 (patch)
treec3d2cb9f68f696bc9377dbaf20897cf0a560afde /src/leap/bitmask/backend_app.py
parent30b02e9153b21d177bf0f79e7132157bf25b636d (diff)
Allow frontend and backend to be run separately.
Add the 'check_online' method to check whether the backend is accessible or not. Reduce the wait for running threads timeout on quit. Add retry feature to the backend requests send.
Diffstat (limited to 'src/leap/bitmask/backend_app.py')
-rw-r--r--src/leap/bitmask/backend_app.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/leap/bitmask/backend_app.py b/src/leap/bitmask/backend_app.py
index 716ae4a7..ce75dc80 100644
--- a/src/leap/bitmask/backend_app.py
+++ b/src/leap/bitmask/backend_app.py
@@ -22,6 +22,8 @@ import multiprocessing
import signal
from leap.bitmask.backend.leapbackend import LeapBackend
+from leap.bitmask.backend.utils import generate_certificates
+from leap.bitmask.logs.utils import create_logger
from leap.bitmask.util import dict_to_flags
logger = logging.getLogger(__name__)
@@ -44,7 +46,7 @@ def signal_handler(signum, frame):
logger.debug("{0}: SIGNAL #{1} catched.".format(pname, signum))
-def run_backend(bypass_checks, flags_dict, frontend_pid=None):
+def run_backend(bypass_checks=False, flags_dict=None, frontend_pid=None):
"""
Run the backend for the application.
@@ -57,8 +59,15 @@ def run_backend(bypass_checks, flags_dict, frontend_pid=None):
signal.signal(signal.SIGINT, signal.SIG_IGN)
signal.signal(signal.SIGTERM, signal_handler)
- dict_to_flags(flags_dict)
+ if flags_dict is not None:
+ dict_to_flags(flags_dict)
backend = LeapBackend(bypass_checks=bypass_checks,
frontend_pid=frontend_pid)
backend.run()
+
+
+if __name__ == '__main__':
+ logger = create_logger(debug=True)
+ generate_certificates()
+ run_backend()