X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=processor.py;h=314f4c5a8f6c6aa67436638080e5ccfa0bf698cd;hb=d223e00705d7b12d833490a345907dae0ae460c4;hp=82124e0c4476ca3550699dd4b0c1b491acb1fff9;hpb=9526ce60749182cea0be7da5838fa04e3d59e0f1;p=electrum-server.git diff --git a/processor.py b/processor.py index 82124e0..314f4c5 100644 --- a/processor.py +++ b/processor.py @@ -24,9 +24,10 @@ def print_log(*args): class Shared: - def __init__(self): + def __init__(self, config): self.lock = threading.Lock() self._stopped = False + self.config = config def stop(self): print_log( "Stopping Stratum" ) @@ -70,8 +71,8 @@ class Processor(threading.Thread): class Dispatcher: - def __init__(self): - self.shared = Shared() + def __init__(self, config): + self.shared = Shared(config) self.request_dispatcher = RequestDispatcher(self.shared) self.request_dispatcher.start() self.response_dispatcher = \ @@ -226,7 +227,7 @@ class Session: addr = None if self.subscriptions: - print_log( "%4s"%self.name, "%14s"%self.address, "%35s"%addr, "%3d"%len(self.subscriptions), self.version ) + print_log( "%4s"%self.name, "%15s"%self.address, "%35s"%addr, "%3d"%len(self.subscriptions), self.version ) def stopped(self): with self.lock: @@ -281,8 +282,9 @@ class ResponseDispatcher(threading.Thread): if internal_id is None: # and method is not None and params is not None: found = self.notification(method, params, response) if not found and method == 'blockchain.address.subscribe': - self.request_dispatcher.push_request(None,{'method':method.replace('.subscribe', '.unsubscribe'), 'params':params, 'id':None}) - pass + params2 = [self.shared.config.get('server','password')] + params + self.request_dispatcher.push_request(None,{'method':method.replace('.subscribe', '.unsubscribe'), 'params':params2, 'id':None}) + # A response elif internal_id is not None: self.send_response(internal_id, response) @@ -298,7 +300,7 @@ class ResponseDispatcher(threading.Thread): if session.contains_subscription(subdesc): session.send_response(response) found = True - if not found: print "no subscriber for", subdesc + # if not found: print_log( "no subscriber for", subdesc) return found def send_response(self, internal_id, response): @@ -306,6 +308,6 @@ class ResponseDispatcher(threading.Thread): if session: response['id'] = message_id session.send_response(response) - else: - print_log( "send_response: no session", message_id, internal_id, response ) + #else: + # print_log( "send_response: no session", message_id, internal_id, response )