[tor-commits] [torflow/master] fixup! Ignore node classes with zero members, rather than asserting
tom at torproject.org
tom at torproject.org
Wed Mar 15 18:43:07 UTC 2017
commit 8be88392e98742c1d77d979d1192a6857d6183c8
Author: teor <teor2345 at gmail.com>
Date: Thu Nov 10 12:18:27 2016 +1100
fixup! Ignore node classes with zero members, rather than asserting
Signed-off-by: teor <teor2345 at gmail.com>
---
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]))
More information about the tor-commits
mailing list