summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-08-02 14:33:58 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-08-02 14:33:58 -0300
commit9bc0b0b8508da85b90cb3390b0bc92410a53acfe (patch)
tree9bf6dbd65b8250c762b2409886e025aec7ec4a42
parenta3c23acaf45b81a6360cd76180c7329a7369b4c5 (diff)
Bugfix, avoid getting negative rates. Closes #3274
-rw-r--r--changes/bug_3274-fix-negative-rates1
-rw-r--r--src/leap/gui/statuspanel.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/changes/bug_3274-fix-negative-rates b/changes/bug_3274-fix-negative-rates
new file mode 100644
index 00000000..78df7a4f
--- /dev/null
+++ b/changes/bug_3274-fix-negative-rates
@@ -0,0 +1 @@
+ o Bugfix, avoid getting negative rates. Closes #3274.
diff --git a/src/leap/gui/statuspanel.py b/src/leap/gui/statuspanel.py
index 7c824e01..f3424c7c 100644
--- a/src/leap/gui/statuspanel.py
+++ b/src/leap/gui/statuspanel.py
@@ -86,6 +86,11 @@ class RateMovingAverage(object):
rate = float(deltatraffic) / float(deltat) / 1024
except ZeroDivisionError:
rate = 0
+
+ # In some cases we get negative rates
+ if rate < 0:
+ rate = 0
+
return rate
def get_total(self):