summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/eip
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-08-06 15:49:34 -0300
committerTomás Touceda <chiiph@leap.se>2014-08-06 15:49:34 -0300
commitaaec2c78dc0bf39d7d4b9ae930de9b7f95ae763c (patch)
treeeec66281a67f1cc99f540b870e2876fcecb78455 /src/leap/bitmask/services/eip
parent0c6ec2f7a5aae716b76d508066fbb69b378fbf43 (diff)
parent9a7485bcaf5460d68b7f601927500299bb2ca9f0 (diff)
Merge remote-tracking branch 'refs/remotes/kali/bug/fix-bad-eip-status' into develop
Diffstat (limited to 'src/leap/bitmask/services/eip')
-rw-r--r--src/leap/bitmask/services/eip/conductor.py13
-rw-r--r--src/leap/bitmask/services/eip/vpnprocess.py19
2 files changed, 28 insertions, 4 deletions
diff --git a/src/leap/bitmask/services/eip/conductor.py b/src/leap/bitmask/services/eip/conductor.py
index b755f283..0ee56628 100644
--- a/src/leap/bitmask/services/eip/conductor.py
+++ b/src/leap/bitmask/services/eip/conductor.py
@@ -16,6 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
EIP Conductor module.
+
+This handles Qt Signals and triggers the calls to the backend,
+where the VPNProcess has been initialized.
"""
import logging
@@ -90,7 +93,7 @@ class EIPConductor(object):
def start_eip_machine(self, action):
"""
- Initializes and starts the EIP state machine.
+ Initialize and start the EIP state machine.
Needs the reference to the eip_status widget not to be empty.
:action: QtAction
@@ -124,8 +127,12 @@ class EIPConductor(object):
@QtCore.Slot()
def _start_eip(self):
"""
- Starts EIP.
+ Start EIP.
+
+ This set a couple of status flags and calls the start procedure in the
+ backend.
"""
+ # TODO status should be kept in a singleton in the backend.
st = self._eip_status
is_restart = st and st.is_restart
@@ -271,7 +278,7 @@ class EIPConductor(object):
TRIGGERS:
Signaler.eip_process_finished
- Triggered when the EIP/VPN process finishes to set the UI
+ Triggered when the EIP/VPN process finishes, in order to set the UI
accordingly.
Ideally we would have the right exit code here,
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py
index c6a7b98b..c7159a93 100644
--- a/src/leap/bitmask/services/eip/vpnprocess.py
+++ b/src/leap/bitmask/services/eip/vpnprocess.py
@@ -202,7 +202,24 @@ class VPN(object):
"aborting openvpn launch.")
return
- cmd = vpnproc.getCommand()
+ # FIXME it would be good to document where the
+ # errors here are catched, since we currently handle them
+ # at the frontend layer. This *should* move to be handled entirely
+ # in the backend.
+ # exception is indeed technically catched in backend, then converted
+ # into a signal, that is catched in the eip_status widget in the
+ # frontend, and converted into a signal to abort the connection that is
+ # sent to the backend again.
+
+ # the whole exception catching should be done in the backend, without
+ # the ping-pong to the frontend, and without adding any logical checks
+ # in the frontend. We should just communicate UI changes to frontend,
+ # and abstract us away from anything else.
+ try:
+ cmd = vpnproc.getCommand()
+ except Exception:
+ logger.error("Error while getting vpn command...")
+ raise
env = os.environ
for key, val in vpnproc.vpn_env.items():
env[key] = val