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

[or-cvs] r18758: {torflow} Add in some random sanity checks. (torflow/trunk/NetworkScanners)



Author: mikeperry
Date: 2009-03-03 03:39:49 -0500 (Tue, 03 Mar 2009)
New Revision: 18758

Modified:
   torflow/trunk/NetworkScanners/soat.py
Log:

Add in some random sanity checks.



Modified: torflow/trunk/NetworkScanners/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/soat.py	2009-03-03 08:39:24 UTC (rev 18757)
+++ torflow/trunk/NetworkScanners/soat.py	2009-03-03 08:39:49 UTC (rev 18758)
@@ -278,7 +278,10 @@
     self.scan_nodes = len(self.nodes)
     # XXX: Wrong:
     self.nodes_to_mark = self.scan_nodes*self.tests_per_node
+    metacon.node_manager._sanity_check(map(lambda id: self.node_map[id], 
+                     self.nodes))
 
+
   def mark_chosen(self, node, result):
     exit_node = metacon.get_exit_node()[1:]
     if exit_node != node:
@@ -2086,6 +2089,8 @@
     try:
       self.rlock.acquire()
       ret = [x for x in self.sorted_r if restriction.r_is_ok(x)]
+      # XXX: Can remove.
+      self._sanity_check(ret)
     finally:
       self.rlock.release()
     plog("DEBUG", "get_nodes_for_port end")
@@ -2542,6 +2547,8 @@
     for test in to_run:
       if not common_nodes: common_nodes = copy.copy(test.nodes)
       else: common_nodes &= test.nodes
+      metacon.node_manager._sanity_check(map(lambda id: test.node_map[id], 
+                                             test.nodes))
 
     if common_nodes:
       current_exit_idhex = random.choice(list(common_nodes))