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

[tor-commits] [torflow/master] Prior to feedback, we used the greater of two ratios.



commit 12eef3b8afb61a0b84bd7709319a225c4deb5a9e
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date:   Mon Nov 7 13:22:22 2011 -0800

    Prior to feedback, we used the greater of two ratios.
    
    Let's keep this behavior in place when the bwauthpid consensus param is
    missing.
---
 NetworkScanners/BwAuthority/aggregate.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py
index f9c95cc..be9c595 100755
--- a/NetworkScanners/BwAuthority/aggregate.py
+++ b/NetworkScanners/BwAuthority/aggregate.py
@@ -246,6 +246,7 @@ def write_file_list(datadir):
   outfile = file(datadir+"/bwfiles.new", "w")
   for f in file_pairs:
    outfile.write(str(f[0])+" "+f[1]+"\n")
+  outfile.write(".\n")
   outfile.close()
   # atomic on POSIX
   os.rename(datadir+"/bwfiles.new", datadir+"/bwfiles")
@@ -362,6 +363,8 @@ def main(argv):
   else:
     true_filt_avg = sum(map(lambda n: n.filt_bw,
                          nodes.itervalues()))/float(len(nodes))
+    true_strm_avg = sum(map(lambda n: n.strm_bw,
+                         nodes.itervalues()))/float(len(nodes))
 
   plog("DEBUG", "Network true_filt_avg: "+str(true_filt_avg))
 
@@ -394,7 +397,7 @@ def main(argv):
   for n in nodes.itervalues():
     n.fbw_ratio = n.filt_bw/true_filt_avg
 
-    # Always use filtered bandwidths
+    # Always use filtered bandwidths for feedback
     n.ratio = n.fbw_ratio
 
     if cs_junk.bwauth_pid_control:
@@ -445,6 +448,13 @@ def main(argv):
         n.pid_bw = n.new_bw
         plog("INFO", "No prev vote for node "+n.nick+": Consensus feedback")
     else: # No PID feedback
+      # Choose the larger between sbw and fbw
+      n.sbw_ratio = n.strm_bw/true_strm_avg
+      if n.sbw_ratio > n.fbw_ratio:
+        n.ratio = n.sbw_ratio
+      else:
+        n.ratio = n.fbw_ratio
+
       n.pid_bw = 0
       n.pid_error = 0
       n.pid_error_sum = 0



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