|
@ -97,6 +97,9 @@ class JSONRPC(asyncio.Protocol, LoggedClass): |
|
|
decode_message for handling. |
|
|
decode_message for handling. |
|
|
''' |
|
|
''' |
|
|
self.recv_size += len(data) |
|
|
self.recv_size += len(data) |
|
|
|
|
|
if self.transport.is_closing(): |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
while True: |
|
|
while True: |
|
|
npos = data.find(ord('\n')) |
|
|
npos = data.find(ord('\n')) |
|
|
if npos == -1: |
|
|
if npos == -1: |
|
@ -118,6 +121,7 @@ class JSONRPC(asyncio.Protocol, LoggedClass): |
|
|
except UnicodeDecodeError as e: |
|
|
except UnicodeDecodeError as e: |
|
|
msg = 'cannot decode binary bytes: {}'.format(e) |
|
|
msg = 'cannot decode binary bytes: {}'.format(e) |
|
|
self.send_json_error(msg, self.PARSE_ERROR) |
|
|
self.send_json_error(msg, self.PARSE_ERROR) |
|
|
|
|
|
self.transport.close() |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
@ -125,6 +129,7 @@ class JSONRPC(asyncio.Protocol, LoggedClass): |
|
|
except json.JSONDecodeError as e: |
|
|
except json.JSONDecodeError as e: |
|
|
msg = 'cannot decode JSON: {}'.format(e) |
|
|
msg = 'cannot decode JSON: {}'.format(e) |
|
|
self.send_json_error(msg, self.PARSE_ERROR) |
|
|
self.send_json_error(msg, self.PARSE_ERROR) |
|
|
|
|
|
self.transport.close() |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
self.on_json_request(message) |
|
|
self.on_json_request(message) |
|
|