commit 5c8159a3e71dbe59d53fdfeaa4a20d07b32728aa
parent 735990f1e3ab566962853fff0591f08eb65b7f14
Author: William Casarin <jb55@jb55.com>
Date: Thu, 3 Mar 2022 10:45:14 -0800
commando: only append data on commando messages
we sometimes get junk messages appended
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lightninglink/RPC.swift b/lightninglink/RPC.swift
@@ -267,11 +267,11 @@ func commando_read_all(ln: LNSocket, timeout_ms: Int32 = 2000) -> RequestRes<Dat
return .failure(RequestError(errorType: .recvFailed))
}
- all_data.append(data[8...])
-
if msgtype == COMMANDO_REPLY_TERM {
+ all_data.append(data[8...])
break
} else if msgtype == COMMANDO_REPLY_CONTINUES {
+ all_data.append(data[8...])
continue
} else {
//return .failure(RequestError(errorType: .badCommandoMsgType(Int(msgtype))))