commit 94b4ad8be77f8470e90274871d4a99f9c9074487
parent b36a71cf93353aa9d390bd01396bd83bd23feee0
Author: ThomasV <thomasv@gitorious>
Date: Tue, 13 Mar 2012 17:31:29 +0100
handle disconnects
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/client/gui.py b/client/gui.py
@@ -1039,7 +1039,7 @@ class ElectrumWindow:
if self.wallet.interface.blocks == 0:
self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
text = "Server not ready"
- elif not self.wallet.interface.was_polled:
+ elif not self.wallet.interface.is_up_to_date:
self.status_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
text = "Synchronizing..."
else:
diff --git a/client/interface.py b/client/interface.py
@@ -221,6 +221,9 @@ class TCPInterface(Interface):
while True:
msg = self.s.recv(1024)
out += msg
+ if msg == '':
+ self.is_connected = False
+ raise BaseException('Socket was disconnected')
while True:
s = out.find('\n')
if s==-1: break
@@ -230,9 +233,9 @@ class TCPInterface(Interface):
cmd = c.get('method')
if cmd == 'server.banner':
self.message = c.get('result')
- if cmd == 'numblocks.subscribe':
+ elif cmd == 'numblocks.subscribe':
self.blocks = c.get('result')
- print "received numblocks",self.blocks
+ print "num blocks",self.blocks
elif cmd =='address.subscribe':
addr = c.get('address')
status = c.get('status')