summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-09-10 21:08:37 +0200
committerKali Kaneko <kali@leap.se>2017-09-10 22:11:40 +0200
commit7953bd1844235bf12ab82c030194c7a78c2b3b28 (patch)
tree262e9b5eae5b5cc30866718f5ea1b96e497b78c6
parent0331bcc09c5fb602366c93ee35c95a2e320b78bd (diff)
[bug] avoid bogus failed status
there was an exception catched, AttributeError, that showed up as a transient "failed" state. - Resolves: #9044
-rw-r--r--src/leap/bitmask/vpn/process.py10
-rw-r--r--src/leap/bitmask/vpn/tunnel.py9
2 files changed, 15 insertions, 4 deletions
diff --git a/src/leap/bitmask/vpn/process.py b/src/leap/bitmask/vpn/process.py
index 93e73d97..7f33e83a 100644
--- a/src/leap/bitmask/vpn/process.py
+++ b/src/leap/bitmask/vpn/process.py
@@ -102,6 +102,7 @@ class _VPNProcess(protocol.ProcessProtocol):
self._providerconfig = providerconfig
self._launcher = get_vpn_launcher()
self._restartfun = restartfun
+ self._status = 'off'
self.restarting = True
self.failed = False
@@ -215,8 +216,13 @@ class _VPNProcess(protocol.ProcessProtocol):
if not self.proto:
return {'status': 'off', 'error': None}
- status = {'status': self.proto.state.simple.lower(),
- 'error': None}
+ try:
+ self._status = self.proto.state.simple.lower()
+ status = {'status': self._status, 'error': None}
+ except AttributeError:
+ # glitch due to proto.state transition?
+ status = {'status': self._status, 'error': None}
+
if self.proto.traffic:
remote = self.proto.remote
rport = self.proto.rport
diff --git a/src/leap/bitmask/vpn/tunnel.py b/src/leap/bitmask/vpn/tunnel.py
index ae863203..64796e9c 100644
--- a/src/leap/bitmask/vpn/tunnel.py
+++ b/src/leap/bitmask/vpn/tunnel.py
@@ -88,8 +88,13 @@ class ConfiguredTunnel(object):
@property
def status(self):
if not self._vpnproc:
- return {'status': 'off', 'error': None}
- return self._vpnproc.status
+ status = {'status': 'off', 'error': None}
+ else:
+ status = self._vpnproc.status
+ # Currently, there's some UI flickering that needs to be debugged #9049
+ # XXX remove this print after that.
+ print ">>>STATUS", status
+ return status
@property
def traffic_status(self):