make connection more robust
This commit is contained in:
parent
9a85fd503d
commit
752761de32
|
@ -487,18 +487,19 @@ class BitcoinGUI:
|
||||||
def update_wallet_thread():
|
def update_wallet_thread():
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
self.is_connected = False
|
||||||
self.wallet.new_session()
|
self.wallet.new_session()
|
||||||
self.is_connected = True
|
self.is_connected = True
|
||||||
self.update_session = False
|
self.update_session = False
|
||||||
self.info.set_text( self.wallet.message)
|
self.info.set_text( self.wallet.message)
|
||||||
except:
|
except:
|
||||||
self.is_connected = False
|
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
time.sleep(self.period)
|
time.sleep(self.period)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
get_servers_time = 0
|
get_servers_time = 0
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
if self.is_connected and self.update_session:
|
if self.is_connected and self.update_session:
|
||||||
self.wallet.update_session()
|
self.wallet.update_session()
|
||||||
self.update_session = False
|
self.update_session = False
|
||||||
|
@ -508,9 +509,11 @@ class BitcoinGUI:
|
||||||
get_servers_time = time.time()
|
get_servers_time = time.time()
|
||||||
|
|
||||||
self.period = 15 if self.wallet.use_http() else 5
|
self.period = 15 if self.wallet.use_http() else 5
|
||||||
try:
|
|
||||||
u = self.wallet.update()
|
u = self.wallet.update()
|
||||||
self.is_connected = True
|
if u:
|
||||||
|
self.wallet.save()
|
||||||
|
gobject.idle_add( self.update_history_tab )
|
||||||
|
time.sleep(self.period)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
print "starting new session"
|
print "starting new session"
|
||||||
break
|
break
|
||||||
|
@ -523,10 +526,6 @@ class BitcoinGUI:
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
break
|
break
|
||||||
self.error = '' if self.is_connected else "Not connected"
|
self.error = '' if self.is_connected else "Not connected"
|
||||||
if u:
|
|
||||||
self.wallet.save()
|
|
||||||
gobject.idle_add( self.update_history_tab )
|
|
||||||
time.sleep(self.period)
|
|
||||||
|
|
||||||
thread.start_new_thread(update_wallet_thread, ())
|
thread.start_new_thread(update_wallet_thread, ())
|
||||||
thread.start_new_thread(update_status_bar_thread, ())
|
thread.start_new_thread(update_status_bar_thread, ())
|
||||||
|
|
Loading…
Reference in New Issue