use a small timeout value initially because the server might be unreachabe

This commit is contained in:
thomasv 2012-10-16 09:52:39 +02:00
parent 14da12921d
commit 4600eeef48
1 changed files with 2 additions and 1 deletions

View File

@ -234,11 +234,12 @@ class TcpStratumInterface(InterfaceAncestor):
import socks
self.s = socks.socksocket()
self.s.setproxy(proxy_modes.index(self.proxy["mode"]), self.proxy["host"], int(self.proxy["port"]) )
self.s.settimeout(60)
self.s.settimeout(2)
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
try:
self.s.connect(( self.host.encode('ascii'), int(self.port)))
self.is_connected = True
self.s.settimeout(60)
self.send([('server.version', [ELECTRUM_VERSION])])
except:
self.is_connected = False