diff options
author | Kali Kaneko <kali@leap.se> | 2014-05-29 12:45:46 -0500 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-05-29 14:20:49 -0500 |
commit | 5f6e44241b4858f1c407f0babfc41f40a06405f1 (patch) | |
tree | 007ec7e13fb5360255e2836e2328795bc678cca1 /src/leap/bitmask/services | |
parent | 2174acd89500ebad2c9b3df034d276e0e857b6f8 (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/bitmask/services')
-rw-r--r-- | src/leap/bitmask/services/eip/conductor.py | 33 | ||||
-rw-r--r-- | src/leap/bitmask/services/eip/vpnprocess.py | 2 |
2 files changed, 27 insertions, 8 deletions
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': ( |