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

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



Author: mikeperry
Date: 2009-09-08 16:57:16 -0400 (Tue, 08 Sep 2009)
New Revision: 20506

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

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



Modified: torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py	2009-09-08 20:52:39 UTC (rev 20505)
+++ torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py	2009-09-08 20:57:16 UTC (rev 20506)
@@ -21,6 +21,7 @@
 import threading
 import ConfigParser
 import sqlalchemy
+import sets
 
 sys.path.append("../../")
 
@@ -131,7 +132,7 @@
     return 0
 
 class BwScanHandler(ScanSupport.ScanHandler):
-  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):
@@ -152,6 +153,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()
@@ -170,7 +179,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
@@ -199,7 +208,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/trunk/NetworkScanners/BwAuthority/run_scan.sh
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/run_scan.sh	2009-09-08 20:52:39 UTC (rev 20505)
+++ torflow/trunk/NetworkScanners/BwAuthority/run_scan.sh	2009-09-08 20:57:16 UTC (rev 20506)
@@ -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/