summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/bitmask/core/autostart.py (renamed from src/leap/bitmask/vpn/autostart.py)0
-rw-r--r--src/leap/bitmask/core/dispatcher.py3
-rw-r--r--src/leap/bitmask/vpn/service.py16
3 files changed, 6 insertions, 13 deletions
diff --git a/src/leap/bitmask/vpn/autostart.py b/src/leap/bitmask/core/autostart.py
index 1c361d82..1c361d82 100644
--- a/src/leap/bitmask/vpn/autostart.py
+++ b/src/leap/bitmask/core/autostart.py
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index 20c0615b..a4b8ce39 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -33,6 +33,7 @@ from leap.common.events import unregister_async as unregister
from leap.common.events import catalog
from .api import APICommand, register_method
+from .autostart import autostart_app
log = Logger()
@@ -196,11 +197,13 @@ class VPNCmd(SubCommand):
except IndexError:
provider = None
d = vpn.start_vpn(provider)
+ autostart_app('on')
return d
@register_method('dict')
def do_STOP(self, vpn, *parts):
d = vpn.stop_vpn()
+ autostart_app('off')
return d
@register_method('dict')
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index 95751ca0..4ce573ba 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -40,7 +40,6 @@ from leap.bitmask.vpn._checks import (
from leap.bitmask.system import IS_LINUX
from leap.bitmask.vpn import privilege, helpers
-from leap.bitmask.vpn import autostart
from leap.common.config import get_path_prefix
from leap.common.files import check_and_fix_urw_only
from leap.common.events import catalog, emit_async
@@ -118,7 +117,6 @@ class VPNService(HookableService):
def start_vpn(self, domain=None):
self.log.debug('Starting VPN')
self._cfg.set('autostart', True)
- autostart.autostart_app('on')
if self.do_status()['status'] == 'on':
exc = Exception('VPN already started')
@@ -162,11 +160,11 @@ class VPNService(HookableService):
def stop_vpn(self, shutdown=False):
if shutdown:
if self._tunnel and self._tunnel.status.get('status') == 'on':
- self._set_autostart('on')
+ self._cfg.set('autostart', True)
else:
- self._set_autostart('off')
+ self._cfg.set('autostart', False)
else:
- self._set_autostart('off')
+ self._cfg.set('autostart', False)
if self._firewall.is_up():
fw_ok = self._firewall.stop()
@@ -184,14 +182,6 @@ class VPNService(HookableService):
self.watchdog.stop()
return {'result': 'vpn stopped'}
- def _set_autostart(self, status):
- if status.lower() == 'on':
- self._cfg.set('autostart', True)
- autostart.autostart_app('on')
- elif status.lower() == 'off':
- self._cfg.set('autostart', False)
- autostart.autostart_app('off')
-
def push_status(self):
try:
statusdict = self.do_status()