summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/_control.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2017-08-08 09:07:09 -0700
committerKali Kaneko <kali@leap.se>2017-08-14 18:10:31 -0400
commit6acf5ddfaf8e091f6b05b814128ac4f38b19c191 (patch)
tree20a1fb8e7a1b6345434ea8901a3fd5120d5b9bbc /src/leap/bitmask/vpn/_control.py
parentb9f651fb98fd639697fafb23f669fd05588b4345 (diff)
[bug] proper vpn shutdown in osx bundles
the restarting flag was not being set. - Resolves: #8959
Diffstat (limited to 'src/leap/bitmask/vpn/_control.py')
-rw-r--r--src/leap/bitmask/vpn/_control.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/leap/bitmask/vpn/_control.py b/src/leap/bitmask/vpn/_control.py
index 7f80f40b..7cf41d1f 100644
--- a/src/leap/bitmask/vpn/_control.py
+++ b/src/leap/bitmask/vpn/_control.py
@@ -90,7 +90,8 @@ class VPNControl(object):
# this could be extended to a collection of
# generic watchers
- poll_list = [LoopingCall(vpnproc.pollStatus),
+ poll_list = [
+ LoopingCall(vpnproc.pollStatus),
LoopingCall(vpnproc.pollState),
LoopingCall(vpnproc.pollLog)]
self._pollers.extend(poll_list)
@@ -115,6 +116,11 @@ class VPNControl(object):
:param restart: whether this stop is part of a hard restart.
:type restart: bool
"""
+ # We assume that the only valid stops are initiated
+ # by an user action, not hard restarts
+ self._user_stopped = not restart
+ self._vpnproc.restarting = restart
+
self._stop_pollers()
try:
self._vpnproc.preDown()
@@ -127,15 +133,10 @@ class VPNControl(object):
# TODO factor this out to a linux-only launcher mechanism.
# First we try to be polite and send a SIGTERM...
if self._vpnproc is not None:
- # We assume that the only valid stops are initiated
- # by an user action, not hard restarts
- self._user_stopped = not restart
- self._vpnproc.restarting = restart
-
self._sentterm = True
self._vpnproc.terminate(shutdown=shutdown)
- # ...but we also trigger a countdown to be unpolite
+ # we trigger a countdown to be unpolite
# if strictly needed.
d = defer.Deferred()
reactor.callLater(