tnetwork: don't store unanswered request if result is in cache - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e33bc2473bf0134b3a5607fd0fb494d51c6d57a2 DIR parent 6d0bc5d9b3356cebbdd90b1d99209fa4528ee9f7 HTML Author: ThomasV <thomasv@gitorious> Date: Sun, 17 May 2015 09:00:36 +0200 network: don't store unanswered request if result is in cache Diffstat: M lib/daemon.py | 4 ++-- M lib/network.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) --- DIR diff --git a/lib/daemon.py b/lib/daemon.py t@@ -115,7 +115,7 @@ class NetworkServer(util.DaemonThread): def __init__(self, config): util.DaemonThread.__init__(self) - self.debug = False + self.debug = 1 self.config = config self.network = Network(config) # network sends responses on that queue t@@ -130,7 +130,7 @@ class NetworkServer(util.DaemonThread): self.requests = {} def add_client(self, client): - for key in ['status','banner','updated','servers','interfaces']: + for key in ['status', 'banner', 'updated', 'servers', 'interfaces']: value = self.network.get_status_value(key) client.response_queue.put({'method':'network.status', 'params':[key, value]}) with self.lock: DIR diff --git a/lib/network.py b/lib/network.py t@@ -461,8 +461,6 @@ class Network(util.DaemonThread): self.response_queue.put(out) return - # store request - self.unanswered_requests[_id] = request if method == 'blockchain.address.subscribe': addr = params[0] self.subscribed_addresses.add(addr) t@@ -470,6 +468,9 @@ class Network(util.DaemonThread): self.response_queue.put({'id':_id, 'result':self.addr_responses[addr]}) return + # store unanswered request + self.unanswered_requests[_id] = request + try: self.interface.send_request(request) except: