Browse Source

fix return, debug flags

283
ThomasV 11 years ago
parent
commit
0a1f6b5c43
  1. 12
      lib/daemon.py

12
lib/daemon.py

@ -43,7 +43,7 @@ class NetworkProxy(threading.Thread):
self.message_id = 0
self.unanswered_requests = {}
self.subscriptions = {}
self.debug = True
self.debug = False
self.lock = threading.Lock()
@ -79,7 +79,7 @@ class NetworkProxy(threading.Thread):
def process(self, response):
# runs callbacks
#print "<--", response
if self.debug: print "<--", response
msg_id = response.get('id')
with self.lock:
@ -110,7 +110,7 @@ class NetworkProxy(threading.Thread):
request = json.dumps( { 'id':self.message_id, 'method':method, 'params':params } )
self.unanswered_requests[self.message_id] = method, params, callback
ids.append(self.message_id)
# print "-->", request
if self.debug: print "-->", request
self.message_id += 1
out += request + '\n'
while out:
@ -179,6 +179,7 @@ class ClientThread(threading.Thread):
self.network = network
self.queue = Queue.Queue()
self.unanswered_requests = {}
self.debug = False
def run(self):
@ -212,7 +213,7 @@ class ClientThread(threading.Thread):
def process(self, request):
#print "<--", request
if self.debug: print "<--", request
method = request['method']
params = request['params']
_id = request['id']
@ -228,6 +229,7 @@ class ClientThread(threading.Thread):
except BaseException as e:
out['error'] =str(e)
self.queue.put(out)
return
if method == 'daemon.shutdown':
self.server.running = False
@ -255,7 +257,7 @@ class ClientThread(threading.Thread):
while out:
n = self.s.send(out)
out = out[n:]
#print "-->", r
if self.debug: print "-->", r

Loading…
Cancel
Save