[tor-commits] [torflow/master] Fix an overflow check
mikeperry at torproject.org
mikeperry at torproject.org
Sun Dec 11 19:48:16 UTC 2011
commit 02e0a0af07679fa52a3d496e6afda219eea2cbd7
Author: Mike Perry <mikeperry-git at fscked.org>
Date: Sun Dec 11 11:45:26 2011 -0800
Fix an overflow check
Tor internally multiplies our values by 1000, and silently eats the overflow.
Why do we bother dividing them by 1000 in the first place? It just causes
confusion and bugs.. The git blame log and comments mumble something about
consensus diffs, but I think we gave up on those...
---
NetworkScanners/BwAuthority/aggregate.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py
index ba6af20..b655db7 100755
--- a/NetworkScanners/BwAuthority/aggregate.py
+++ b/NetworkScanners/BwAuthority/aggregate.py
@@ -735,9 +735,9 @@ def main(argv):
# Go through the list and cap them to NODE_CAP
for n in nodes.itervalues():
- if n.new_bw >= 0xffffffff*1000:
+ if n.new_bw >= 0xffffffff:
plog("WARN", "Bandwidth of node "+n.nick+"="+n.idhex+" exceeded maxint32: "+str(n.new_bw))
- n.new_bw = 0xffffffff*1000
+ n.new_bw = 0xffffffff
if cs_junk.T_i > 0 and cs_junk.T_i_decay > 0 \
and math.fabs(n.pid_error_sum) > \
math.fabs(2*cs_junk.T_i*n.pid_error/cs_junk.T_i_decay):
More information about the tor-commits
mailing list