MCPcopy Create free account
hub / github.com/ElementsProject/lightning / read_nofail

Function read_nofail

cli/lightning-cli.c:376–388  ·  view source on GitHub ↗

Always returns a positive number < len. len must be > 0! */

Source from the content-addressed store, hash-verified

374
375/* Always returns a positive number < len. len must be > 0! */
376static size_t read_nofail(int fd, void *buf, size_t len)
377{
378 ssize_t i;
379 assert(len > 0);
380
381 i = cli_read(fd, buf, len);
382 if (i == 0)
383 errx(ERROR_TALKING_TO_LIGHTNINGD,
384 "reading response: socket closed");
385 else if (i < 0)
386 err(ERROR_TALKING_TO_LIGHTNINGD, "reading response");
387 return i;
388}
389
390/* We rely on the fact that lightningd terminates all JSON RPC responses with
391 * "\n\n", so we can stream even if we can't parse. */

Callers 1

oom_dumpFunction · 0.85

Calls 2

errxFunction · 0.85
errFunction · 0.85

Tested by

no test coverage detected