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

Function dev_disconnect_permanent

lightningd/subd.c:938–958  ·  view source on GitHub ↗

If test specified that this disconnection should cause permanent failure */

Source from the content-addressed store, hash-verified

936
937/* If test specified that this disconnection should cause permanent failure */
938bool dev_disconnect_permanent(struct lightningd *ld)
939{
940 char permfail[strlen("PERMFAIL")];
941 int r;
942
943 if (ld->dev_disconnect_fd == -1)
944 return false;
945
946 r = read(ld->dev_disconnect_fd, permfail, sizeof(permfail));
947 if (r < 0)
948 fatal("Reading dev_disconnect file: %s", strerror(errno));
949
950 if (memeq(permfail, r, "permfail", strlen("permfail")))
951 return true;
952
953 /* Nope, restore. */
954 if (lseek(ld->dev_disconnect_fd, -r, SEEK_CUR) < 0) {
955 fatal("lseek failure");
956 }
957 return false;
958}
959#endif /* DEVELOPER */
960
961/* Ugly helper to get full pathname of the current binary. */

Callers 2

channel_errFunction · 0.70

Calls 2

memeqFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected