summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/_control.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-06-29 12:39:59 +0200
committerRuben Pollan <meskio@sindominio.net>2017-07-20 21:37:02 +0200
commitd18de54f1fe00c0f7cfa3be64faed9863e248231 (patch)
treef9b518a7f0450db2901d93e744fe745415b1038e /src/leap/bitmask/vpn/_control.py
parentf6ff8482c14ad49c6ee77c4d7918520a0013c132 (diff)
[refactor] move TunnelManager duties to VPNService
VPNService has knowledge of the tunnel and the firewall and controls them separately. Also exceptions from VPNControl are handled locally instead of being propagated. - Resolves: #8976 - Related: #8942
Diffstat (limited to 'src/leap/bitmask/vpn/_control.py')
-rw-r--r--src/leap/bitmask/vpn/_control.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/leap/bitmask/vpn/_control.py b/src/leap/bitmask/vpn/_control.py
index a57c6e4..7f80f40 100644
--- a/src/leap/bitmask/vpn/_control.py
+++ b/src/leap/bitmask/vpn/_control.py
@@ -66,17 +66,23 @@ class VPNControl(object):
vpnproc.preUp()
except Exception as e:
self.log.error('Error on vpn pre-up {0!r}'.format(e))
- raise
+ return False
try:
cmd = vpnproc.getCommand()
except Exception as e:
self.log.error(
'Error while getting vpn command... {0!r}'.format(e))
- raise
+ return False
env = os.environ
- runningproc = reactor.spawnProcess(vpnproc, cmd[0], cmd, env)
+ try:
+ runningproc = reactor.spawnProcess(vpnproc, cmd[0], cmd, env)
+ except Exception as e:
+ self.log.error(
+ 'Error while spwanning vpn process... {0!r}'.format(e))
+ return False
+
vpnproc.pid = runningproc.pid
self._vpnproc = vpnproc