mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +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:
parent
760b053d7b
commit
356dcbba97
1 changed files with 4 additions and 0 deletions
|
@ -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"))
|
||||
|
|
Loading…
Add table
Reference in a new issue