[or-cvs] r20505: {torflow} Don't finish a slice if we don't get enough streams to succe (torflow/branches/stable/NetworkScanners/BwAuthority)

mikeperry at seul.org mikeperry at seul.org
Tue Sep 8 20:52:39 UTC 2009


Author: mikeperry
Date: 2009-09-08 16:52:39 -0400 (Tue, 08 Sep 2009)
New Revision: 20505

Modified:
   torflow/branches/stable/NetworkScanners/BwAuthority/bwauthority.py
   torflow/branches/stable/NetworkScanners/BwAuthority/run_scan.sh
Log:

Don't finish a slice if we don't get enough streams to
succeed.



Modified: torflow/branches/stable/NetworkScanners/BwAuthority/bwauthority.py
===================================================================
--- torflow/branches/stable/NetworkScanners/BwAuthority/bwauthority.py	2009-09-08 20:50:55 UTC (rev 20504)
+++ torflow/branches/stable/NetworkScanners/BwAuthority/bwauthority.py	2009-09-08 20:52:39 UTC (rev 20505)
@@ -21,6 +21,7 @@
 import threading
 import ConfigParser
 import sqlalchemy
+import sets
 
 sys.path.append("../../")
 
@@ -240,7 +241,7 @@
     cond.wait()
     cond.release()
 
-  def is_count_met(self, count, position=0):
+  def is_count_met(self, count, num_streams, position=0):
     cond = threading.Condition()
     cond._finished = True # lol python haxx. Could make subclass, but why?? :)
     def notlambda(this):
@@ -261,6 +262,14 @@
             plog("DEBUG", "Exit router "+r.idhex+"="+r.nickname+" not done: "+str(r._generated[position])+", down: "+str(r.down)+", OK: "+str(this.selmgr.path_selector.exit_gen.rstr_list.r_is_ok(r))+", sorted_r: "+str(r in this.sorted_r))
             # XXX:
             #break
+        if cond._finished:
+           num_routers = len(
+                 sets.Set(this.selmgr.path_selector.entry_gen.rstr_routers
+                           + this.selmgr.path_selector.exit_gen.rstr_routers))
+           if cond._num_streams < (2*num_routers*count)/3:
+             plog("WARN", "Not enough streams yet. "+str(num_streams)+" < "+
+                        str(2*num_routers*count/3))
+             cond._finished = False
       cond.notify()
       cond.release()
     cond.acquire()
@@ -356,7 +365,7 @@
   # 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
+    if hdlr.is_count_met(circs_per_node, successful): break
     hdlr.wait_for_consensus()
 
     # Check local time. Do not scan between 01:30 and 05:30 local time
@@ -385,7 +394,7 @@
       plog('WARN', 'Timer exceeded limit: ' + str(delta_build) + '\n')
 
     build_exit = hdlr.get_exit_node()
-    if ret == 1:
+    if ret == 1 and build_exit:
       successful += 1
       plog('DEBUG', str(start_pct) + '-' + str(stop_pct) + '% circuit build+fetch took ' + str(delta_build) + ' for ' + str(build_exit))
     else:

Modified: torflow/branches/stable/NetworkScanners/BwAuthority/run_scan.sh
===================================================================
--- torflow/branches/stable/NetworkScanners/BwAuthority/run_scan.sh	2009-09-08 20:50:55 UTC (rev 20504)
+++ torflow/branches/stable/NetworkScanners/BwAuthority/run_scan.sh	2009-09-08 20:52:39 UTC (rev 20505)
@@ -1,11 +1,7 @@
 #!/bin/bash
 
 # This tor must have the w status line fix as well as the stream bw fix
-# Ie: 
-#      git remote add mikeperry git://git.torproject.org/~mikeperry/git/tor
-#      git fetch mikeperry
-#      git branch --track rs-format-fix7 mikeperry/rs-format-fix7
-#      git checkout rs-format-fix7
+# Ie git master or 0.2.2.x
 TOR_EXE=../../../tor.git/src/or/tor
 PYTHONPATH=../../../SQLAlchemy-0.5.5/lib:../../../Elixir-0.6.1/
 



More information about the tor-commits mailing list