network: don't store unanswered request if result is in cache

This commit is contained in:
ThomasV 2015-05-17 09:00:36 +02:00
parent 6d0bc5d9b3
commit e33bc2473b
2 changed files with 5 additions and 4 deletions

View file

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

View file

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