commit 4600eeef48bbe80809f04d43dce89b491ced3d95
parent 14da12921d3aeb3500a22692c2992ff4ca40aacd
Author: thomasv <thomasv@gitorious>
Date: Tue, 16 Oct 2012 09:52:39 +0200
use a small timeout value initially because the server might be unreachabe
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/interface.py b/lib/interface.py
@@ -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