X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=processor.py;h=d012f5d706c972832e7874e9695a090cf81220f4;hb=6e292a968278287f1ec190fd6bf09ee2ac8fd0b2;hp=40054082f3b24eacdeefa6aade193be4a9e2a1e7;hpb=ec5f0c1796f754a1831c48daadae4c24b81d430b;p=electrum-server.git diff --git a/processor.py b/processor.py index 4005408..d012f5d 100644 --- a/processor.py +++ b/processor.py @@ -40,7 +40,7 @@ class Processor(threading.Thread): pass def push_response(self, response): - print "response", response + #print "response", response self.dispatcher.request_dispatcher.push_response(response) @@ -164,20 +164,20 @@ class Session: self.subscriptions = [] self.address = '' self.name = '' - #threading.Timer(2, self.info).start() + threading.Timer(2, self.info).start() # Debugging method. Doesn't need to be threadsafe. def info(self): for sub in self.subscriptions: - print sub - method, params = sub + #print sub + method = sub[0] if method == 'blockchain.address.subscribe': - addr = params[0] + addr = sub[1] break else: addr = None - print (timestr(), self.name, self.address, addr, - len(self.subscriptions), self.version) + print timestr(), self.name, self.address, addr,\ + len(self.subscriptions), self.version def stopped(self): with self.lock: @@ -186,14 +186,15 @@ class Session: def subscribe_to_service(self, method, params): subdesc = self.build_subdesc(method, params) with self.lock: - self.subscriptions.append(subdesc) + if subdesc is not None: + self.subscriptions.append(subdesc) # subdesc = A subscription description @staticmethod def build_subdesc(method, params): if method == "blockchain.numblocks.subscribe": return method, - elif method == "blockchain.address.get_history": + elif method == "blockchain.address.subscribe": if not params: return None else: @@ -226,10 +227,10 @@ class ResponseDispatcher(threading.Thread): params = response.get('params') # A notification - if internal_id is None and method is not None and params is not None: + if internal_id is None: # and method is not None and params is not None: self.notification(method, params, response) # A response - elif internal_id is not None and method is None and params is None: + elif internal_id is not None: # and method is None and params is None: self.send_response(internal_id, response) else: print "no method", response