Browse Source

no daemon

283
ThomasV 12 years ago
parent
commit
9afbf21197
  1. 7
      electrum
  2. 5
      lib/interface.py
  3. 4
      lib/verifier.py
  4. 11
      lib/wallet.py

7
electrum

@ -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:

5
lib/interface.py

@ -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 = {}

4
lib/verifier.py

@ -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']

11
lib/wallet.py

@ -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']

Loading…
Cancel
Save