From bf1984d8707454c1cf13169cc8f937fc3be1dfae Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Wed, 28 Jun 2017 15:19:15 +0200 Subject: [feat] Stop the vpn (and all services) when application is shut down - Resolves: #8852 --- src/leap/bitmask/core/service.py | 2 ++ src/leap/bitmask/vpn/service.py | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/leap') diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py index 9ff599e3..2da1ee4c 100644 --- a/src/leap/bitmask/core/service.py +++ b/src/leap/bitmask/core/service.py @@ -245,6 +245,8 @@ class BitmaskBackend(configurable.ConfigurableService): return self.core_commands.do_version() def do_stop(self): + for service in self: + service.stopService() return self.core_commands.do_stop() # Service Toggling diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index fc39bcc8..343a2d35 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -62,13 +62,12 @@ class VPNService(HookableService): self._basepath = basepath def startService(self): - print "Starting VPN Service..." # TODO this could trigger a check for validity of the certificates, # etc. super(VPNService, self).startService() def stopService(self): - print "Stopping VPN Service..." + self.stop_vpn() super(VPNService, self).stopService() @defer.inlineCallbacks @@ -105,9 +104,6 @@ class VPNService(HookableService): raise Exception('Could not start VPN, check logs') def stop_vpn(self): - # TODO ----------------------------- - # when shutting down the main bitmaskd daemon, this should be called. - if not self._tunnelmanager: raise Exception('VPN was not running') -- cgit v1.2.3