[or-cvs] r21554: {torflow} Demote notice for 0 bandwidth result. Also set value to 1 in (torflow/branches/stable/NetworkScanners/BwAuthority)

Mike Perry mikeperry-svn at fscked.org
Wed Feb 3 19:21:53 UTC 2010


Author: mikeperry
Date: 2010-02-03 19:21:52 +0000 (Wed, 03 Feb 2010)
New Revision: 21554

Modified:
   torflow/branches/stable/NetworkScanners/BwAuthority/aggregate.py
Log:

Demote notice for 0 bandwidth result. Also set value to 1
in that case, so the router is at least still used
*sometimes*.



Modified: torflow/branches/stable/NetworkScanners/BwAuthority/aggregate.py
===================================================================
--- torflow/branches/stable/NetworkScanners/BwAuthority/aggregate.py	2010-02-02 23:03:30 UTC (rev 21553)
+++ torflow/branches/stable/NetworkScanners/BwAuthority/aggregate.py	2010-02-03 19:21:52 UTC (rev 21554)
@@ -71,12 +71,19 @@
   # to minimize changes for consensus diffs.
   # Resulting error is +/-0.5%
   if bw_val == 0:
-    plog("NOTICE", "Zero bandwidth!")
-    return 0
-  return int(max((1000,
+    plog("INFO", "Zero input bandwidth.. Upping to 1")
+    return 1
+  else:
+    ret = int(max((1000,
                    round(round(bw_val,-(int(math.log10(bw_val))-2)),
                                                        -3)))/1000)
+    if ret == 0:
+      plog("INFO", "Zero output bandwidth.. Upping to 1")
+      return 1
+    return ret
 
+
+
 def closest_to_one(ratio_list):
   min_dist = 0x7fffffff
   min_item = -1
@@ -238,7 +245,7 @@
   if GUARD_BETA == -1:
     # Compute GUARD_BETA based on the upgrade rate for nsbw obeying routers
     # (karsten's data show this slightly underestimates client upgrade rate)
-    guardbw_yes = NodeRestrictionList([VersionRangeRestriction("0.2.1.22"),
+    guardbw_yes = NodeRestrictionList([VersionRangeRestriction("0.2.1.23"),
        NotNodeRestriction(VersionRangeRestriction("0.2.2.0", "0.2.2.6"))])
 
     if not sorted_rlist:



More information about the tor-commits mailing list