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

[or-cvs] r19415: {torflow} Some fixes for buildtimes relating to running out of nodes a (torflow/trunk/CircuitAnalysis/BuildTimes)



Author: mikeperry
Date: 2009-05-04 03:00:05 -0400 (Mon, 04 May 2009)
New Revision: 19415

Modified:
   torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py
Log:

Some fixes for buildtimes relating to running out of nodes
after applying restrictions. More fixes probably needed for
this case.



Modified: torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py	2009-05-04 06:58:15 UTC (rev 19414)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py	2009-05-04 07:00:05 UTC (rev 19415)
@@ -18,9 +18,11 @@
 from TorCtl import StatsSupport
 from TorCtl.StatsSupport import StatsHandler
 from TorCtl import PathSupport, TorCtl
-from TorCtl.PathSupport import ExitPolicyRestriction,OrNodeRestriction
+from TorCtl.PathSupport import ExitPolicyRestriction,OrNodeRestriction,RestrictionError
 from TorCtl.TorUtil import plog
 
+import traceback
+
 # For testing:
 from dist_check import run_check
 
@@ -38,6 +40,7 @@
       use_exit=None,
       use_guards=True,
       restrict_guards=False)
+      #extra_node_rstr=PathSupport.RateLimitedRestriction(True))
 
 # Original value of FetchUselessDescriptors
 FUDValue = None
@@ -248,8 +251,13 @@
           plog("DEBUG", "Too many circuits: "+str(h.circ_count-h.circ_succeeded-h.circ_failed)+", delaying build")
           h.schedule_low_prio(circuit_builder)
           return
-        circ = h.c.build_circuit(h.selmgr.select_path())   
-        h.circuits[circ.circ_id] = circ
+        try:
+          circ = h.c.build_circuit(h.selmgr.select_path())   
+          h.circuits[circ.circ_id] = circ
+        except RestrictionError, e:
+          # XXX: Hrmm..
+          traceback.print_exc()
+          plog("WARN", "Impossible restrictions: "+str(e))
       c._handler.schedule_low_prio(circuit_builder)
     except TorCtl.ErrorReply,e:
       plog("NOTICE","Error building circuit: " + str(e.args))