commit cff8515e3c88951f6c205299967a3a41ebc0b737
parent 6ebac023462bdb55a43746837f727dfc36426ba5
Author: ThomasV <thomasv@gitorious>
Date: Thu, 14 Nov 2013 09:23:38 +0100
on sl error: print exception inside for loop, and do not continue the loop
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/interface.py b/lib/interface.py
@@ -326,12 +326,12 @@ class Interface(threading.Thread):
try:
s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_SSLv3, cert_reqs=ssl.CERT_NONE, ca_certs=None)
except ssl.SSLError, e:
+ print_error("SSL error retrieving SSL certificate:", self.host, e)
s = None
- continue
+
break
- if s == None:
- print_error("SSL error retrieving SSL certificate:", self.host, e)
+ if s is None:
return
dercert = s.getpeercert(True)
@@ -351,14 +351,13 @@ class Interface(threading.Thread):
s = socket.socket( res[0], socket.SOCK_STREAM )
s.settimeout(2)
s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
-
s.connect(res[4])
except:
s = None
continue
break
- if s == None:
+ if s is None:
print_error("failed to connect", self.host, self.port)
return