[or-cvs] r20257: {torflow} Always use the most recent measurements. Screw this closest (torflow/trunk/NetworkScanners/BwAuthority)

mikeperry at seul.org mikeperry at seul.org
Mon Aug 10 07:00:00 UTC 2009


Author: mikeperry
Date: 2009-08-10 03:00:00 -0400 (Mon, 10 Aug 2009)
New Revision: 20257

Modified:
   torflow/trunk/NetworkScanners/BwAuthority/aggregate.py
   torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py
Log:

Always use the most recent measurements. Screw this closest
to 1 stuff.



Modified: torflow/trunk/NetworkScanners/BwAuthority/aggregate.py
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/aggregate.py	2009-08-10 06:25:54 UTC (rev 20256)
+++ torflow/trunk/NetworkScanners/BwAuthority/aggregate.py	2009-08-10 07:00:00 UTC (rev 20257)
@@ -104,16 +104,37 @@
   def avg_ns_bw(self):
     return sum(self.ns_bw)/float(len(self.ns_bw))
 
-  def choose_strm_bw(self, net_avg):
+  # This can be bad for bootstrapping or highly bw-variant nodes... 
+  # we will choose an old measurement in that case.. We need
+  # to build some kind of time-bias here..
+  def _choose_strm_bw_one(self, net_avg):
     i = closest_to_one(map(lambda f: f/net_avg, self.strm_bw))
     self.chosen_sbw = i
     return self.chosen_sbw
 
-  def choose_filt_bw(self, net_avg):
+  def _choose_filt_bw_one(self, net_avg):
     i = closest_to_one(map(lambda f: f/net_avg, self.filt_bw))
     self.chosen_fbw = i
     return self.chosen_fbw
 
+  # Simply return the most recent one instead of this
+  # closest-to-one stuff
+  def choose_filt_bw(self, new_avg):
+    max_idx = 0
+    for i in xrange(len(self.timestamps)):
+      if self.timestamps[i] > self.timestamps[max_idx]:
+        max_idx = i
+    self.chosen_fbw = max_idx
+    return self.chosen_fbw
+
+  def choose_strm_bw(self, new_avg):
+    max_idx = 0
+    for i in xrange(len(self.timestamps)):
+      if self.timestamps[i] > self.timestamps[max_idx]:
+        max_idx = i
+    self.chosen_sbw = max_idx
+    return self.chosen_sbw
+
 class Line:
   def __init__(self, line, slice_file, timestamp):
     self.idhex = re.search("[\s]*node_id=([\S]+)[\s]*", line).group(1)

Modified: torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py	2009-08-10 06:25:54 UTC (rev 20256)
+++ torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py	2009-08-10 07:00:00 UTC (rev 20257)
@@ -343,7 +343,10 @@
 
   attempt = 0
   successful = 0
-  while not hdlr.is_count_met(circs_per_node):
+  # XXX: Also run for at least 2*circs_per_node*nodes/3 successful fetches
+  # to ensure we don't skip slices in the case of temporary network failure
+  while True:
+    if hdlr.is_count_met(circs_per_node): break
     hdlr.wait_for_consensus()
 
     # Check local time. Do not scan between 01:30 and 05:30 local time



More information about the tor-commits mailing list