summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-01-17 19:35:54 +0100
committerKali Kaneko <kali@leap.se>2018-01-25 01:19:13 +0100
commit40ee176057d214d5307d9addecd4df8db6231e73 (patch)
treeaaef5aec770a170c5598c05b4d40c42a400d654b /src/leap
parentb70e259490f8030931924cc9ccf6cb3708b06746 (diff)
[feat] implement autostart for vpn
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/vpn/service.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index 6f182fcc..db4c20af 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -106,13 +106,14 @@ class VPNService(HookableService):
def stopService(self):
try:
- self.stop_vpn()
+ self.stop_vpn(shutdown=True)
except Exception as e:
self.log.error('Error stopping vpn service... {0!r}'.format(e))
super(VPNService, self).stopService()
@defer.inlineCallbacks
def start_vpn(self, domain=None):
+ self._cfg.set('autostart', True)
if self.do_status()['status'] == 'on':
exc = Exception('VPN already started')
exc.expected = True
@@ -154,7 +155,8 @@ class VPNService(HookableService):
self.watchdog.start(WATCHDOG_PERIOD)
defer.returnValue(data)
- def stop_vpn(self):
+ def stop_vpn(self, shutdown=False):
+ self._cfg.set('autostart', shutdown)
if self._firewall.is_up():
fw_ok = self._firewall.stop()
if not fw_ok: