summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-05-29 12:45:46 -0500
committerKali Kaneko <kali@leap.se>2014-05-29 14:20:49 -0500
commit5f6e44241b4858f1c407f0babfc41f40a06405f1 (patch)
tree007ec7e13fb5360255e2836e2328795bc678cca1 /src/leap
parent2174acd89500ebad2c9b3df034d276e0e857b6f8 (diff)
display restart error after SIGTERM[soft,tls-error]
- fix tls-error: is SIGTERM now - connect to connection-died signal - display error to user
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/backend.py2
-rw-r--r--src/leap/bitmask/gui/eip_status.py21
-rw-r--r--src/leap/bitmask/gui/mainwindow.py2
-rw-r--r--src/leap/bitmask/gui/statemachines.py4
-rw-r--r--src/leap/bitmask/services/eip/conductor.py33
-rw-r--r--src/leap/bitmask/services/eip/vpnprocess.py2
6 files changed, 46 insertions, 18 deletions
diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py
index f0fe50f9..1ab5b40d 100644
--- a/src/leap/bitmask/backend.py
+++ b/src/leap/bitmask/backend.py
@@ -1718,7 +1718,7 @@ class Backend(object):
"""
self._call_queue.put(("eip", "start", None))
- def eip_stop(self, shutdown=False, restart=False):
+ def eip_stop(self, shutdown=False, restart=False, failed=False):
"""
Stop the EIP service.
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py
index ca209d6a..04acc167 100644
--- a/src/leap/bitmask/gui/eip_status.py
+++ b/src/leap/bitmask/gui/eip_status.py
@@ -361,7 +361,7 @@ class EIPStatusWidget(QtGui.QWidget):
self.eipconnection.qtsigs.do_connect_signal)
@QtCore.Slot(dict)
- def eip_stopped(self, restart=False):
+ def eip_stopped(self, restart=False, failed=False):
"""
TRIGGERS:
EIPConductor.qtsigs.disconnected_signal
@@ -378,16 +378,29 @@ class EIPStatusWidget(QtGui.QWidget):
# status positively.
# Or better call it from the conductor...
- clear_traffic = self.tr("Traffic is being routed in the clear")
- unreachable_net = self.tr("Network is unreachable")
+ clear_traffic = self.tr("Traffic is being routed in the clear.")
+ unreachable_net = self.tr("Network is unreachable.")
+ failed_msg = self.tr("Cannot start Encrypted Proxy.")
if restart:
msg = unreachable_net
+ elif failed:
+ msg = failed_msg
else:
msg = clear_traffic
self.ui.lblEIPMessage.setText(msg)
self.ui.lblEIPStatus.show()
+ def eip_failed_to_restart(self):
+ """
+ Update EIP messages.
+ """
+ msg = self.tr("Could not restart Encrypted Proxy")
+ self.ui.lblEIPMessage.setText(msg)
+ self.ui.lblEIPStatus.show()
+
+ self.set_eip_status(self.tr("You can start the service manually."))
+
@QtCore.Slot(dict)
def update_vpn_status(self, data=None):
"""
@@ -530,7 +543,7 @@ class EIPStatusWidget(QtGui.QWidget):
self.set_eip_status(eip_status_label, error=True)
# signal connection_aborted to state machine:
- qtsigs = self._eip_connection.qtsigs
+ qtsigs = self._eipconnection.qtsigs
qtsigs.connection_aborted_signal.emit()
def _on_eip_openvpn_already_running(self):
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index aa317d96..98d9fb8b 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -1764,7 +1764,7 @@ class MainWindow(QtGui.QMainWindow):
if self._systray is not None:
self._systray.showMessage(
self.tr('Quitting...'),
- self.tr('The app is quitting, please wait.'))
+ self.tr('Bitmask is quitting, please wait.'))
# explicitly process events to display tooltip immediately
QtCore.QCoreApplication.processEvents(0, 10)
diff --git a/src/leap/bitmask/gui/statemachines.py b/src/leap/bitmask/gui/statemachines.py
index 2a876b83..f8e5479d 100644
--- a/src/leap/bitmask/gui/statemachines.py
+++ b/src/leap/bitmask/gui/statemachines.py
@@ -55,10 +55,6 @@ class SignallingState(QState):
"""
Emits the signal on entry.
"""
- print "IIIIIIIIIIIIIIIIIII"
- print "TO STATE", self._name, self.objectName()
- print "IIIIIIIIIIIIIIIIIII"
-
logger.debug('State %s::%s entered. Emitting signal ...'
% (self._name, self.objectName()))
if self._signal is not None:
diff --git a/src/leap/bitmask/services/eip/conductor.py b/src/leap/bitmask/services/eip/conductor.py
index 7cc80014..0cd4c95c 100644
--- a/src/leap/bitmask/services/eip/conductor.py
+++ b/src/leap/bitmask/services/eip/conductor.py
@@ -81,6 +81,7 @@ class EIPConductor(object):
# for conductor
signaler.eip_process_restart_tls.connect(self._do_eip_restart)
+ signaler.eip_process_restart_tls.connect(self._do_eip_failed)
signaler.eip_process_restart_ping.connect(self._do_eip_restart)
signaler.eip_process_finished.connect(self._eip_finished)
@@ -141,7 +142,7 @@ class EIPConductor(object):
self._backend.eip_start()
@QtCore.Slot()
- def _stop_eip(self, restart=False):
+ def _stop_eip(self, restart=False, failed=False):
"""
TRIGGERS:
self.qsigs.do_disconnect_signal (via state machine)
@@ -151,9 +152,12 @@ class EIPConductor(object):
:param restart: whether this is part of a eip restart.
:type restart: bool
+
+ :param failed: whether this is the final step of a retry sequence
+ :type failed: bool
"""
self._eip_status.is_restart = restart
- self.user_stopped_eip = not restart
+ self.user_stopped_eip = not restart and not failed
def on_disconnected_do_restart():
# hard restarts
@@ -166,11 +170,9 @@ class EIPConductor(object):
QtDelayedCall(2000, self.do_connect)
def plug_restart_on_disconnected():
- #print "PLUGGING RESTART ON DISCONNECTED"
self.qtsigs.disconnected_signal.connect(on_disconnected_do_restart)
def reconnect_disconnected_signal():
- #print "RECONNECTING DISCONNECTED SIGNAL"
self.qtsigs.disconnected_signal.disconnect(
on_disconnected_do_restart)
@@ -178,7 +180,6 @@ class EIPConductor(object):
self._stop_eip(restart=False)
def reconnect_stop_signal():
- #print "RECONNECTING StOP SIGNAL"
self.qtsigs.disconnecting_signal.disconnect()
self.qtsigs.disconnecting_signal.connect(do_stop)
@@ -190,6 +191,10 @@ class EIPConductor(object):
# ...and reconnect the original signal again, after having used the
# diversion
QtDelayedCall(500, reconnect_disconnected_signal)
+
+ elif failed:
+ self.qtsigs.disconnected_signal.emit()
+
else:
logger.debug('Setting autostart to: False')
self._settings.set_autostart_eip(False)
@@ -197,9 +202,11 @@ class EIPConductor(object):
# Call to the backend.
self._backend.eip_stop(restart=restart)
- self._already_started_eip = False
+ # ... and inform the status widget
self._eip_status.set_eipstatus_off(False)
- self._eip_status.eip_stopped(restart=restart)
+ self._eip_status.eip_stopped(restart=restart, failed=failed)
+
+ self._already_started_eip = False
# XXX needed?
if restart:
@@ -227,6 +234,18 @@ class EIPConductor(object):
self.qtsigs.disconnecting_signal.connect(do_stop)
self.qtsigs.do_disconnect_signal.emit()
+ @QtCore.Slot()
+ def _do_eip_failed(self):
+ """
+ Stop EIP after a failure to start.
+
+ TRIGGERS
+ signaler.eip_process_restart_tls
+ """
+ logger.debug("TLS Error: eip_stop (failed)")
+ self.qtsigs.connection_died_signal.emit()
+ QtDelayedCall(1000, self._eip_status.eip_failed_to_restart)
+
@QtCore.Slot(int)
def _eip_finished(self, exitCode):
"""
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py
index 6eef05af..098619be 100644
--- a/src/leap/bitmask/services/eip/vpnprocess.py
+++ b/src/leap/bitmask/services/eip/vpnprocess.py
@@ -70,7 +70,7 @@ class VPNObserver(object):
'NETWORK_UNREACHABLE': (
'Network is unreachable (code=101)',),
'PROCESS_RESTART_TLS': (
- "SIGUSR1[soft,tls-error]",),
+ "SIGTERM[soft,tls-error]",),
'PROCESS_RESTART_PING': (
"SIGTERM[soft,ping-restart]",),
'INITIALIZATION_COMPLETED': (