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

[tor-commits] [torflow/master] fixup! Ignore node classes with zero members, rather than asserting



commit 8be88392e98742c1d77d979d1192a6857d6183c8
Author: teor <teor2345@xxxxxxxxx>
Date:   Thu Nov 10 12:18:27 2016 +1100

    fixup! Ignore node classes with zero members, rather than asserting
    
    Signed-off-by: teor <teor2345@xxxxxxxxx>
---
 NetworkScanners/BwAuthority/aggregate.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py
index 912f908..5e91bcf 100755
--- a/NetworkScanners/BwAuthority/aggregate.py
+++ b/NetworkScanners/BwAuthority/aggregate.py
@@ -508,7 +508,10 @@ def main(argv):
       while prev_pid_avg > pid_tgt_avg[cl]:
         f_nodes = filter(lambda n: n.desc_bw >= pid_tgt_avg[cl], c_nodes)
         prev_pid_avg = pid_tgt_avg[cl]
-        pid_tgt_avg[cl] = sum(map(lambda n: n.filt_bw, f_nodes))/float(len(f_nodes))
+        if len(f_nodes) > 0:
+          pid_tgt_avg[cl] = sum(map(lambda n: n.filt_bw, f_nodes))/float(len(f_nodes))
+        else:
+          pid_tgt_avg[cl] = 0.0
 
       plog("INFO", "Network true_filt_avg["+cl+"]: "+str(true_filt_avg[cl]))
       plog("INFO", "Network pid_tgt_avg["+cl+"]: "+str(pid_tgt_avg[cl]))

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