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

[or-cvs] r19241: {torflow} Test for validity of refetch_ip at startup. (torflow/trunk/NetworkScanners)



Author: mikeperry
Date: 2009-04-08 01:24:51 -0400 (Wed, 08 Apr 2009)
New Revision: 19241

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

Test for validity of refetch_ip at startup.



Modified: torflow/trunk/NetworkScanners/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/soat.py	2009-04-08 04:52:41 UTC (rev 19240)
+++ torflow/trunk/NetworkScanners/soat.py	2009-04-08 05:24:51 UTC (rev 19241)
@@ -2569,6 +2569,16 @@
     plog('INFO', 'Done.')
     sys.exit(0)
 
+  # Make sure refetch_ip is valid rather than exploding mid-test
+  global refetch_ip
+  BindingSocket.bind_to = refetch_ip
+  try:
+    s = socket.socket()
+  except socket.error, e:
+    plog("WARN", "Cannot bind to "+refetch_ip+". Ignoring refetch_ip setting.")
+    refetch_ip = None
+  BindingSocket.bind_to = None
+ 
   if do_rescan:
     plog("NOTICE", "Loading rescan.")
     for test in tests.itervalues():