summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/_management.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-02-04 17:01:25 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2017-02-23 00:40:37 +0100
commit701fe5ebc70fb49bb32e81e6d6605f27ad09925b (patch)
tree0763df29131f3abe4604fc3626f51ed4360b5ff1 /src/leap/bitmask/vpn/_management.py
parent409a4c663ec3c0b4a394fcaa6d4b1c6b527f8522 (diff)
[feature] parse status
- simple status parsing - add separate firewall status - set status for abnormal termination
Diffstat (limited to 'src/leap/bitmask/vpn/_management.py')
-rw-r--r--src/leap/bitmask/vpn/_management.py32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/leap/bitmask/vpn/_management.py b/src/leap/bitmask/vpn/_management.py
index 920bd9d1..905372b1 100644
--- a/src/leap/bitmask/vpn/_management.py
+++ b/src/leap/bitmask/vpn/_management.py
@@ -45,16 +45,8 @@ class VPNManagement(object):
# Timers, in secs
CONNECTION_RETRY_TIME = 1
- def __init__(self, signaler=None):
- """
- Initializes the VPNManager.
-
- :param signaler: Signaler object used to send notifications to the
- backend
- :type signaler: backend.Signaler
- """
+ def __init__(self):
self._tn = None
- self._signaler = signaler
self.aborted = False
def _seek_to_eof(self):
@@ -227,8 +219,8 @@ class VPNManagement(object):
def _parse_state_and_notify(self, output):
"""
- Parses the output of the state command and emits state_changed
- signal when the state changes.
+ Parses the output of the state command, and trigger a state transition
+ when the state changes.
:param output: list of lines that the state command printed as
its output
@@ -248,9 +240,9 @@ class VPNManagement(object):
state = status_step
if state != self._last_state:
- if self._signaler is not None:
- self._signaler.signal(
- self._signaler.eip_state_changed, state)
+ # XXX this status object is the vpn status observer
+ if self._status:
+ self._status.set_status(state, None)
self._last_state = state
def _parse_status_and_notify(self, output):
@@ -286,12 +278,12 @@ class VPNManagement(object):
elif text == "TUN/TAP write bytes":
tun_tap_write = value # upload
- status = (tun_tap_read, tun_tap_write)
- if status != self._last_status:
- if self._signaler is not None:
- self._signaler.signal(
- self._signaler.eip_status_changed, status)
- self._last_status = status
+ traffic_status = (tun_tap_read, tun_tap_write)
+ if traffic_status != self._last_status:
+ # XXX this status object is the vpn status observer
+ if self._status:
+ self._status.set_traffic_status(traffic_status)
+ self._last_status = traffic_status
def get_state(self):
"""