From 40ee176057d214d5307d9addecd4df8db6231e73 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 17 Jan 2018 19:35:54 +0100 Subject: [feat] implement autostart for vpn --- src/leap/bitmask/vpn/service.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/leap/bitmask/vpn') 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: -- cgit v1.2.3