summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/_status.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/vpn/_status.py')
-rw-r--r--src/leap/bitmask/vpn/_status.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/leap/bitmask/vpn/_status.py b/src/leap/bitmask/vpn/_status.py
index 6bd9c7c9..5d41a535 100644
--- a/src/leap/bitmask/vpn/_status.py
+++ b/src/leap/bitmask/vpn/_status.py
@@ -74,9 +74,10 @@ class VPNStatus(object):
elif status in self._CONNECTED:
status = "on"
- self._status = status
- self.errcode = errcode
- emit_async(catalog.VPN_STATUS_CHANGED)
+ if self._status != status:
+ self._status = status
+ self.errcode = errcode
+ emit_async(catalog.VPN_STATUS_CHANGED)
def get_traffic_status(self):
down = None
@@ -87,7 +88,8 @@ class VPNStatus(object):
up = bytes2human(self._traffic_up)
return {'down': down, 'up': up}
- def set_traffic_status(self, status):
- up, down = status
- self._traffic_up = up
- self._traffic_down = down
+ def set_traffic_status(self, up, down):
+ if up != self._traffic_up or down != self._traffic_down:
+ self._traffic_up = up
+ self._traffic_down = down
+ emit_async(catalog.VPN_STATUS_CHANGED)