summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-06-28 15:19:15 +0200
committerRuben Pollan <meskio@sindominio.net>2017-06-29 00:32:22 +0200
commitbf1984d8707454c1cf13169cc8f937fc3be1dfae (patch)
tree526a681e0de9da407aa6d0baa36eb2abd78bf4d7
parentb62d0e2390bc1cc6bd51e97801b2b8ef853b1a44 (diff)
[feat] Stop the vpn (and all services) when application is shut down
- Resolves: #8852
-rw-r--r--docs/changelog.rst1
-rw-r--r--src/leap/bitmask/core/service.py2
-rw-r--r--src/leap/bitmask/vpn/service.py6
3 files changed, 4 insertions, 5 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 64a47e8..2748484 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -14,6 +14,7 @@ Features
- `#8819 <https://0xacab.org/leap/bitmask-dev/issues/8819>`_: Send key to provider if a new priv key is putted in the keyring
- `#8821 <https://0xacab.org/leap/bitmask-dev/issues/8821>`_: Add a 'fetch' flag to key export
- `#8049 <https://0xacab.org/leap/bitmask-dev/issues/8049>`_: Restart the VPN automatically
+- `#8852 <https://0xacab.org/leap/bitmask-dev/issues/8852>`_: Stop the vpn (and all services) when application is shut down
- Initial cli port of the legacy vpn code
- Add VPN API to bitmask.js
- Add vpn get_cert command
diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py
index 9ff599e..2da1ee4 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 fc39bcc..343a2d3 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')