commit bade5741881e2b5c44b5a37caae324a28a583af5
parent 4726d3a1fc88d31b3035e0b02b19cf5981218692
Author: ThomasV <thomasv@gitorious>
Date: Tue, 2 Jun 2015 16:28:49 +0200
Merge branch 'master' of git://github.com/spesmilo/electrum
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/interface.py b/lib/interface.py
@@ -154,6 +154,8 @@ class TcpInterface(threading.Thread):
try:
s = socket.socket(res[0], socket.SOCK_STREAM)
s.connect(res[4])
+ s.settimeout(2)
+ s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
return s
except BaseException as e:
continue
@@ -181,6 +183,8 @@ class TcpInterface(threading.Thread):
# get server certificate.
# Do not use ssl.get_server_certificate because it does not work with proxy
s = self.get_simple_socket()
+ if s is None:
+ return
try:
s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_SSLv23, cert_reqs=ssl.CERT_NONE, ca_certs=None)
except ssl.SSLError, e:
@@ -202,9 +206,6 @@ class TcpInterface(threading.Thread):
if s is None:
return
- s.settimeout(2)
- s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
-
if self.use_ssl:
try:
s = ssl.wrap_socket(s,