From 0626d6349472bdcd934328165cfe1a0e7d891bfe Mon Sep 17 00:00:00 2001
From: Kali Kaneko <kali@leap.se>
Date: Wed, 4 Jun 2014 10:11:46 -0500
Subject: catch openvpn unexpected ending

show also the back-to-clearnet button on that case.
---
 src/leap/bitmask/gui/eip_status.py         |  5 +++++
 src/leap/bitmask/gui/mainwindow.py         |  1 +
 src/leap/bitmask/services/eip/conductor.py | 10 ++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py
index fd8b35c3..7649f840 100644
--- a/src/leap/bitmask/gui/eip_status.py
+++ b/src/leap/bitmask/gui/eip_status.py
@@ -400,6 +400,11 @@ class EIPStatusWidget(QtGui.QWidget):
         self.eip_conductor._backend.tear_fw_down()
         QtDelayedCall(50, self.hide_fw_down_button)
 
+        # XXX do actual check
+        msg = "Traffic is being routed in the clear."
+        self.set_eip_message(msg)
+        self.set_eip_status("")
+
     @QtCore.Slot(dict)
     def eip_stopped(self, restart=False, failed=False):
         """
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index e7406106..968e5ead 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -1564,6 +1564,7 @@ class MainWindow(QtGui.QMainWindow):
 
         if should_start and not self._already_started_eip:
             # XXX this should be handled by the state machine.
+            self._enable_eip_start_action()
             self._eip_status.set_eip_status(
                 self.tr("Starting..."))
             self._eip_status.eip_button.setEnabled(False)
diff --git a/src/leap/bitmask/services/eip/conductor.py b/src/leap/bitmask/services/eip/conductor.py
index 3c031952..4c01225f 100644
--- a/src/leap/bitmask/services/eip/conductor.py
+++ b/src/leap/bitmask/services/eip/conductor.py
@@ -297,8 +297,11 @@ class EIPConductor(object):
             signal = self.qtsigs.connection_aborted_signal
             self._backend.eip_terminate()
 
-        # XXX FIXME --- check exitcode is != 0 really
-        if exitCode != 0 and not self.user_stopped_eip:
+        # XXX FIXME --- check exitcode is != 0 really.
+        # bitmask-root is masking the exitcode, so we might need
+        # to fix it on that side.
+        #if exitCode != 0 and not self.user_stopped_eip:
+        if not self.user_stopped_eip:
             eip_status_label = self._eip_status.tr(
                 "{0} finished in an unexpected manner!")
             eip_status_label = eip_status_label.format(self.eip_name)
@@ -307,6 +310,9 @@ class EIPConductor(object):
             self._eip_status.set_eip_status(eip_status_label,
                                             error=True)
             signal = self.qtsigs.connection_died_signal
+            self._eip_status.show_fw_down_button()
+            msg = self._eip_status.tr("Outgoing traffic is blocked")
+            self._eip_status.set_eip_message(msg)
 
         if exitCode == 0 and IS_MAC:
             # XXX remove this warning after I fix cocoasudo.
-- 
cgit v1.2.3