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

[or-cvs] [torflow/master 12/92] getaddrinfo doesn't necessarily return a set of unique IPs



Author: John M. Schanck <john@xxxxxxxxxxx>
Date: Tue, 22 Jun 2010 15:57:36 -0400
Subject: getaddrinfo doesn't necessarily return a set of unique IPs
Commit: dc815034a1458279e2107661415ae334083de2b6

This commit cuts down on duplicate requests
---
 NetworkScanners/ExitAuthority/soat.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/NetworkScanners/ExitAuthority/soat.py b/NetworkScanners/ExitAuthority/soat.py
index adf8bf8..d33f8c8 100755
--- a/NetworkScanners/ExitAuthority/soat.py
+++ b/NetworkScanners/ExitAuthority/soat.py
@@ -1853,17 +1853,17 @@ class SSLTest(SearchBasedTest):
       ssl_domain = SSLDomain(address)
 
     check_ips = []
+    resolved = []
     # Make 3 resolution attempts
     for attempt in xrange(1,4):
       try:
-        resolved = []
-        resolved = socket.getaddrinfo(address, 443)
+        resolved = socket.getaddrinfo(address, 443, socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
         break
       except socket.gaierror:
-        plog("NOTICE", "Local resolution failure #"+str(attempt)+" for "+address)
+        plog("NOTICE", "Local resolution failure #%d for %s" % (attempt, address))
 
     for res in resolved:
-      if res[0] == socket.AF_INET and res[2] == socket.IPPROTO_TCP:
+      if res[4][0] not in check_ips:
         check_ips.append(res[4][0])
 
     if not check_ips:
-- 
1.7.1