X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=blobdiff_plain;f=server.py;h=cf0e29124acfc73a9ee3c0ccf978d7e6851949bf;hp=42b6b9f487a3cf52384b955f21ab69517995ca9b;hb=d279585f870a5a931e9b5610f0c4982e0948d430;hpb=d9bbde33c1faca005c47bce650650907991d9c51 diff --git a/server.py b/server.py index 42b6b9f..cf0e291 100755 --- a/server.py +++ b/server.py @@ -704,9 +704,17 @@ def tcp_client_thread(ipaddr,conn): if s ==-1: break else: - c = msg[0:s] + c = msg[0:s].strip() msg = msg[s+1:] - c = json.loads(c) + if c == 'quit': + conn.close() + close_session(session_id) + return + try: + c = json.loads(c) + except: + print "json error", repr(c) + continue try: cmd = c['method'] data = c['params'] @@ -718,6 +726,7 @@ def tcp_client_thread(ipaddr,conn): input_queue.put((session_id, cmd, data)) + # read commands from the input queue. perform requests, etc. this should be called from the main thread. def process_input_queue(): while not stopping: