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

Function read_nofail

cli/lightning-cli.c:384–396  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

382
383/* Always returns a positive number < len. len must be > 0! */
384static size_t read_nofail(int fd, void *buf, size_t len)
385{
386 ssize_t i;
387 assert(len > 0);
388
389 i = cli_read(fd, buf, len);
390 if (i == 0)
391 errx(ERROR_TALKING_TO_LIGHTNINGD,
392 "reading response: socket closed");
393 else if (i < 0)
394 err(ERROR_TALKING_TO_LIGHTNINGD, "reading response");
395 return i;
396}
397
398/* We rely on the fact that lightningd terminates all JSON RPC responses with
399 * "\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