summaryrefslogtreecommitdiff
path: root/src/leap/baseapp
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-01-16 00:58:22 +0900
committerkali <kali@leap.se>2013-01-16 00:58:22 +0900
commitbf39c45eddc62733fdb72b4f46cdb81ec649cb30 (patch)
tree3a0a31077cb6cb1e4ec1bbcfc2cd08e6b08adf4b /src/leap/baseapp
parent8139b39dedc3dc99d310d082f6edb10d2303a1ce (diff)
handle loss of tun iface
trigger only one dialog and disconnect. additional cleanup of log handling.
Diffstat (limited to 'src/leap/baseapp')
-rw-r--r--src/leap/baseapp/log.py6
-rw-r--r--src/leap/baseapp/network.py24
2 files changed, 21 insertions, 9 deletions
diff --git a/src/leap/baseapp/log.py b/src/leap/baseapp/log.py
index 95cfc918..e6a767fb 100644
--- a/src/leap/baseapp/log.py
+++ b/src/leap/baseapp/log.py
@@ -11,6 +11,7 @@ class LogPaneMixin(object):
a simple log pane
that writes new lines as they come
"""
+ EXCLUDES = ('MANAGEMENT',)
def createLogBrowser(self):
"""
@@ -60,6 +61,7 @@ class LogPaneMixin(object):
simple slot: writes new line to logger Pane.
"""
msg = line[:-1]
- if self.debugmode:
+ if self.debugmode and all(map(lambda w: w not in msg,
+ LogPaneMixin.EXCLUDES)):
self.logbrowser.append(msg)
- vpnlogger.info(msg)
+ vpnlogger.info(msg)
diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py
index a33265e5..a67f6340 100644
--- a/src/leap/baseapp/network.py
+++ b/src/leap/baseapp/network.py
@@ -17,6 +17,8 @@ class NetworkCheckerAppMixin(object):
initialize an instance of the Network Checker,
which gathers error and passes them on.
"""
+ ERR_NETERR = False
+
def __init__(self, *args, **kwargs):
provider = kwargs.pop('provider', None)
if provider:
@@ -41,11 +43,19 @@ class NetworkCheckerAppMixin(object):
slot that receives a network exceptions
and raises a user error message
"""
- logger.debug('handling network exception')
- logger.error(exc.message)
- dialog = ErrorDialog(parent=self)
+ # FIXME this should not HANDLE anything after
+ # the network check thread has been stopped.
- if exc.critical:
- dialog.criticalMessage(exc.usermessage, "network error")
- else:
- dialog.warningMessage(exc.usermessage, "network error")
+ logger.debug('handling network exception')
+ if not self.ERR_NETERR:
+ self.ERR_NETERR = True
+
+ logger.error(exc.message)
+ dialog = ErrorDialog(parent=self)
+ if exc.critical:
+ dialog.criticalMessage(exc.usermessage, "network error")
+ else:
+ dialog.warningMessage(exc.usermessage, "network error")
+
+ self.start_or_stopVPN()
+ self.network_checker.stop()