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

[or-cvs] r19297: {torflow} Handle case where no exit is used (can happen when we reques (torflow/trunk/NetworkScanners)



Author: mikeperry
Date: 2009-04-11 16:05:20 -0400 (Sat, 11 Apr 2009)
New Revision: 19297

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

Handle case where no exit is used (can happen
when we request an exit that just went down, 
for example).



Modified: torflow/trunk/NetworkScanners/libsoat.py
===================================================================
--- torflow/trunk/NetworkScanners/libsoat.py	2009-04-11 19:40:42 UTC (rev 19296)
+++ torflow/trunk/NetworkScanners/libsoat.py	2009-04-11 20:05:20 UTC (rev 19297)
@@ -92,10 +92,16 @@
 class TestResult(object):
   ''' Parent class for all test result classes '''
   def __init__(self, exit_obj, site, status, reason=None):
-    self.exit_node = exit_obj.idhex
-    self.exit_name = exit_obj.nickname
-    self.exit_ip = exit_obj.ip
-    self.contact = exit_obj.contact
+    if exit_obj:
+      self.exit_node = exit_obj.idhex
+      self.exit_name = exit_obj.nickname
+      self.exit_ip = exit_obj.ip
+      self.contact = exit_obj.contact
+    else:
+      self.exit_node = "[No Exit Used]"
+      self.exit_name = ""
+      self.exit_ip = ""
+      self.contact = "[No Exit Used]"
     self.exit_obj = exit_obj
     self.site = site
     self.timestamp = time.time()

Modified: torflow/trunk/NetworkScanners/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/soat.py	2009-04-11 19:40:42 UTC (rev 19296)
+++ torflow/trunk/NetworkScanners/soat.py	2009-04-11 20:05:20 UTC (rev 19297)
@@ -1642,7 +1642,7 @@
     exit_node = metacon.get_exit_node()
     if not exit_node or exit_node == '0':
       plog('NOTICE', 'We had no exit node to test, skipping to the next test.')
-      result = SSLTestResult("NoExit", "NotSupplied!", 
+      result = SSLTestResult(None, 
                               address, ssl_file_name, TEST_INCONCLUSIVE,
                               INCONCLUSIVE_NOEXIT)
       if self.rescan_nodes: result.from_rescan = True