mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
pylightning: RPC returns a failure if the connection is lost
This commit is contained in:
parent
9c7c2a3f2f
commit
225f29abf4
1 changed files with 4 additions and 1 deletions
|
@ -21,7 +21,10 @@ class UnixDomainSocketRpc(object):
|
||||||
buff = b''
|
buff = b''
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
buff += sock.recv(1024)
|
b = sock.recv(1024)
|
||||||
|
buff += b
|
||||||
|
if len(b) == 0:
|
||||||
|
return {'error': 'Connection to RPC server lost.'}
|
||||||
# Convert late to UTF-8 so glyphs split across recvs do not
|
# Convert late to UTF-8 so glyphs split across recvs do not
|
||||||
# impact us
|
# impact us
|
||||||
objs, _ = self.decoder.raw_decode(buff.decode("UTF-8"))
|
objs, _ = self.decoder.raw_decode(buff.decode("UTF-8"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue