no daemon
This commit is contained in:
parent
0ad7f72d3d
commit
9afbf21197
7
electrum
7
electrum
|
@ -230,7 +230,8 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
verifier = WalletVerifier(interface, config)
|
verifier = WalletVerifier(interface, config)
|
||||||
wallet.set_verifier(verifier)
|
wallet.set_verifier(verifier)
|
||||||
WalletSynchronizer(wallet, config).start()
|
synchronizer = WalletSynchronizer(wallet, config)
|
||||||
|
synchronizer.start()
|
||||||
|
|
||||||
if not found and a == 'restore' and s is not None:
|
if not found and a == 'restore' and s is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -250,9 +251,11 @@ if __name__ == '__main__':
|
||||||
verifier.start()
|
verifier.start()
|
||||||
gui.main(url)
|
gui.main(url)
|
||||||
wallet.save()
|
wallet.save()
|
||||||
|
|
||||||
verifier.stop()
|
verifier.stop()
|
||||||
synchronizer.stop()
|
synchronizer.stop()
|
||||||
#interface.stop()
|
interface.stop()
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if cmd not in known_commands:
|
if cmd not in known_commands:
|
||||||
|
|
|
@ -495,6 +495,11 @@ class Interface(threading.Thread):
|
||||||
self.is_connected = False # this exits the polling loop
|
self.is_connected = False # this exits the polling loop
|
||||||
self.trigger_callback('disconnecting') # for actively disconnecting
|
self.trigger_callback('disconnecting') # for actively disconnecting
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
if self.protocol in 'st' and self.s:
|
||||||
|
self.s.shutdown(socket.SHUT_RDWR)
|
||||||
|
self.s.close()
|
||||||
|
|
||||||
|
|
||||||
def get_servers_list(self):
|
def get_servers_list(self):
|
||||||
plist = {}
|
plist = {}
|
||||||
|
|
|
@ -65,6 +65,7 @@ class WalletVerifier(threading.Thread):
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
with self.lock: self.running = False
|
with self.lock: self.running = False
|
||||||
|
self.interface.poke('verifier')
|
||||||
|
|
||||||
def is_running(self):
|
def is_running(self):
|
||||||
with self.lock: return self.running
|
with self.lock: return self.running
|
||||||
|
@ -126,9 +127,10 @@ class WalletVerifier(threading.Thread):
|
||||||
self.pending_headers.remove(header)
|
self.pending_headers.remove(header)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = self.interface.get_response('verifier',timeout=0.1)
|
r = self.interface.get_response('verifier',timeout=1)
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
continue
|
continue
|
||||||
|
if not r: continue
|
||||||
|
|
||||||
# 3. handle response
|
# 3. handle response
|
||||||
method = r['method']
|
method = r['method']
|
||||||
|
|
|
@ -1165,6 +1165,7 @@ class WalletSynchronizer(threading.Thread):
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
with self.lock: self.running = False
|
with self.lock: self.running = False
|
||||||
|
self.interface.poke('synchronizer')
|
||||||
|
|
||||||
def is_running(self):
|
def is_running(self):
|
||||||
with self.lock: return self.running
|
with self.lock: return self.running
|
||||||
|
@ -1233,14 +1234,10 @@ class WalletSynchronizer(threading.Thread):
|
||||||
self.was_updated = False
|
self.was_updated = False
|
||||||
|
|
||||||
# 2. get a response
|
# 2. get a response
|
||||||
try:
|
r = self.interface.get_response('synchronizer')
|
||||||
r = self.interface.get_response('synchronizer', timeout=0.1)
|
|
||||||
except:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# poke sends None. (check if still needed)
|
# poke sends None. (needed during stop)
|
||||||
if not r:
|
if not r: continue
|
||||||
continue
|
|
||||||
|
|
||||||
# 3. handle response
|
# 3. handle response
|
||||||
method = r['method']
|
method = r['method']
|
||||||
|
|
Loading…
Reference in New Issue