mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-11 10:04:28 +01:00
pylightning: Don't attempt to deserialize after every read
We make use of the structure of the final read to decide when to deserialize.
This commit is contained in:
committed by
Rusty Russell
parent
760b053d7b
commit
356dcbba97
@@ -29,6 +29,10 @@ class UnixDomainSocketRpc(object):
|
||||
buff += b
|
||||
if len(b) == 0:
|
||||
return {'error': 'Connection to RPC server lost.'}
|
||||
|
||||
if buff[-3:] != b' }\n':
|
||||
continue
|
||||
|
||||
# Convert late to UTF-8 so glyphs split across recvs do not
|
||||
# impact us
|
||||
objs, _ = self.decoder.raw_decode(buff.decode("UTF-8"))
|
||||
|
||||
Reference in New Issue
Block a user