Browse Source

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

283
thomasv 12 years ago
parent
commit
4600eeef48
  1. 3
      lib/interface.py

3
lib/interface.py

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

Loading…
Cancel
Save