Browse Source

pylightning: Don't attempt to deserialize after every read

We make use of the structure of the final read to decide when to deserialize.
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
356dcbba97
  1. 4
      contrib/pylightning/lightning/lightning.py

4
contrib/pylightning/lightning/lightning.py

@ -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…
Cancel
Save