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

[or-cvs] r18686: {torctl} Fix a warn and a couple more exceptions... (torctl/trunk/python/TorCtl)



Author: mikeperry
Date: 2009-02-24 05:15:09 -0500 (Tue, 24 Feb 2009)
New Revision: 18686

Modified:
   torctl/trunk/python/TorCtl/PathSupport.py
Log:

Fix a warn and a couple more exceptions...



Modified: torctl/trunk/python/TorCtl/PathSupport.py
===================================================================
--- torctl/trunk/python/TorCtl/PathSupport.py	2009-02-24 04:28:49 UTC (rev 18685)
+++ torctl/trunk/python/TorCtl/PathSupport.py	2009-02-24 10:15:09 UTC (rev 18686)
@@ -116,6 +116,10 @@
     self.restrictions = filter(
         lambda r: not isinstance(r, RestrictionClass),
           self.restrictions)
+  
+  def clear(self):
+    """ Remove all restrictions """
+    self.restrictions = []
 
   def __str__(self):
     return self.__class__.__name__+"("+str(map(str, self.restrictions))+")"
@@ -1044,12 +1048,12 @@
   def set_exit(self, exit_name):
     # sets an exit, if bad, sets bad_exit
     exit_id = None
-    self.exit_rstr.del_restriction(IdHexRestriction)
+    self.exit_rstr.clear()
     if exit_name:
       if exit_name[0] == '$':
         exit_id = exit_name
       elif exit_name in self.consensus.name_to_key:
-        exit_id = self.consensus.name_to_key[exit_id]
+        exit_id = self.consensus.name_to_key[exit_name]
     self.exit_id = exit_id
     if not exit_id or exit_id[1:] not in self.consensus.routers \
             or self.consensus.routers[exit_id[1:]].down:
@@ -1452,7 +1456,7 @@
         # traffic. 
         self.streams[s.strm_id].failed = True
         if s.circ_id in self.circuits: self.circuits[s.circ_id].dirty = True
-        if s.circ_id == 0 and s.reason == "TIMEOUT":
+        elif s.circ_id == 0 and s.reason == "TIMEOUT":
           plog("NOTICE", "Timeout for "+str(s.strm_id)) 
         else: plog("WARN","Failed stream on unknown circ "+str(s.circ_id))
         return