no daemon

This commit is contained in:
ThomasV 2012-11-24 20:31:07 +01:00
parent 0ad7f72d3d
commit 9afbf21197
4 changed files with 17 additions and 10 deletions

View File

@ -230,7 +230,8 @@ if __name__ == '__main__':
verifier = WalletVerifier(interface, config)
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:
try:
@ -250,9 +251,11 @@ if __name__ == '__main__':
verifier.start()
gui.main(url)
wallet.save()
verifier.stop()
synchronizer.stop()
#interface.stop()
interface.stop()
sys.exit(0)
if cmd not in known_commands:

View File

@ -495,6 +495,11 @@ class Interface(threading.Thread):
self.is_connected = False # this exits the polling loop
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):
plist = {}

View File

@ -65,6 +65,7 @@ class WalletVerifier(threading.Thread):
def stop(self):
with self.lock: self.running = False
self.interface.poke('verifier')
def is_running(self):
with self.lock: return self.running
@ -126,9 +127,10 @@ class WalletVerifier(threading.Thread):
self.pending_headers.remove(header)
try:
r = self.interface.get_response('verifier',timeout=0.1)
r = self.interface.get_response('verifier',timeout=1)
except Queue.Empty:
continue
if not r: continue
# 3. handle response
method = r['method']

View File

@ -1165,6 +1165,7 @@ class WalletSynchronizer(threading.Thread):
def stop(self):
with self.lock: self.running = False
self.interface.poke('synchronizer')
def is_running(self):
with self.lock: return self.running
@ -1233,14 +1234,10 @@ class WalletSynchronizer(threading.Thread):
self.was_updated = False
# 2. get a response
try:
r = self.interface.get_response('synchronizer', timeout=0.1)
except:
continue
r = self.interface.get_response('synchronizer')
# poke sends None. (check if still needed)
if not r:
continue
# poke sends None. (needed during stop)
if not r: continue
# 3. handle response
method = r['method']