[or-cvs] r15465: Apply restrictions upon generator rewind. Should help cases (in torflow/branches/gsoc2008: . TorCtl)

mikeperry at seul.org mikeperry at seul.org
Wed Jun 25 21:42:00 UTC 2008


Author: mikeperry
Date: 2008-06-25 17:41:59 -0400 (Wed, 25 Jun 2008)
New Revision: 15465

Modified:
   torflow/branches/gsoc2008/TorCtl/PathSupport.py
   torflow/branches/gsoc2008/guardslices.py
Log:

Apply restrictions upon generator rewind. Should help cases
where there are only a few routers matching a restriction in
a given set, at the expense of slower rewinds() and path
construction in other cases.



Modified: torflow/branches/gsoc2008/TorCtl/PathSupport.py
===================================================================
--- torflow/branches/gsoc2008/TorCtl/PathSupport.py	2008-06-25 18:46:58 UTC (rev 15464)
+++ torflow/branches/gsoc2008/TorCtl/PathSupport.py	2008-06-25 21:41:59 UTC (rev 15465)
@@ -146,7 +146,8 @@
     # FIXME: If we apply the restrictions now, we can save cycles
     # during selection, and also some memory overhead (at the cost
     # of a much slower rewind() though..)
-    self.routers = copy.copy(self.sorted_r)
+    self.routers = filter(lambda r: self.rstr_list.r_is_ok(r), self.sorted_r)
+    #self.routers = copy.copy(self.sorted_r)
 
   def mark_chosen(self, r):
     """Mark a router as chosen: remove it from the list of routers 

Modified: torflow/branches/gsoc2008/guardslices.py
===================================================================
--- torflow/branches/gsoc2008/guardslices.py	2008-06-25 18:46:58 UTC (rev 15464)
+++ torflow/branches/gsoc2008/guardslices.py	2008-06-25 21:41:59 UTC (rev 15465)
@@ -4,7 +4,7 @@
 
 import socket,sys,time,getopt,os
 from TorCtl.TorUtil import meta_port,meta_host,control_port,control_host
-from StatsSupport import StatsHandler
+from TorCtl.StatsSupport import StatsHandler
 from TorCtl import PathSupport, TorCtl
 __selmgr = PathSupport.SelectionManager(
       pathlen=3,
@@ -178,7 +178,7 @@
   __selmgr.percent_fast = p+5
   __selmgr.percent_skip = p
   
-  c = getdata(basefile_name,ncircuits) 
+  c = getdata(basefile_name,ncircuits)
 
   for i in range(0,ncircuits):
     print 'Building circuit',i



More information about the tor-commits mailing list