lightning.py: parse multiple JSON RPC commands accurately.

We need to keep the remaining buffer, and we need to try to parse it
before we read the next.  I first tried keeping it in the object, but
its lifetime is that of the *socket*, which we actually reopen for
every command.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-11-18 20:13:28 +10:30
committed by Christian Decker
parent fe11ee5406
commit 0c3f85d931
3 changed files with 14 additions and 14 deletions

View File

@@ -611,8 +611,9 @@ def test_multirpc(node_factory):
sock.sendall(b'\n'.join(commands))
buff = b''
for i in commands:
l1.rpc._readobj(sock)
_, buff = l1.rpc._readobj(sock, buff)
sock.close()