commit 0a1f6b5c43fbaf6a8f672b18eba11b3aa8e8b24f
parent 919ec8e837eef30364212eb7f95e26fc8cc7f850
Author: ThomasV <thomasv@gitorious>
Date: Tue, 11 Mar 2014 07:12:57 +0100
fix return, debug flags
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/daemon.py b/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