[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [doctor/master] Stacktrace if there aren't any bandwidth authorities



commit 845c276a2339cdcaf2cda729dd51b677a26422f0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Oct 11 15:08:20 2014 -0700

    Stacktrace if there aren't any bandwidth authorities
    
    If there aren't any bandwidth authority measurements then we divide by zero,
    resulting in a stacktrace. Caught by tom on...
    
      https://trac.torproject.org/projects/tor/ticket/13390
---
 consensus_health_checker.py |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index d424ca4..a86855d 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -641,6 +641,9 @@ def bandwidth_authorities_in_sync(latest_consensus, consensuses, votes):
     if measured:
       measurement_counts[authority] = len(measured)
 
+  if not measurement_counts:
+    return
+
   average = sum(measurement_counts.values()) / len(measurement_counts)
 
   for authority, count in measurement_counts.items():

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits