[tor-commits] [sbws/master] fix: v3bwfile: Stop calculating failures with 0 attempts

juga at torproject.org juga at torproject.org
Tue Apr 14 13:54:37 UTC 2020


commit 1225c5d9ea738723e272288d6734dbc651cf2d7b
Author: juga0 <juga at riseup.net>
Date:   Sun Mar 22 07:09:19 2020 +0000

    fix: v3bwfile: Stop calculating failures with 0 attempts
---
 sbws/lib/v3bwfile.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index 6465892..245ffa6 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -379,7 +379,8 @@ class V3BWHeader(object):
         # failures = attempts - all mesaurements
         # Works only in the case that old measurements files already had
         # measurements count
-        if recent_measurement_attempt_count is not None:
+        # If this is None or 0, the failures can't be calculated
+        if recent_measurement_attempt_count:
             all_measurements = 0
             for result_list in results.values():
                 all_measurements += len(result_list)





More information about the tor-commits mailing list