mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
9b1d240c1f
We use a file descriptor, so when we consume an entry, we move past it (and everyone shares a file offset, so this works). The file contains packet names prefixed by - (treat fd as closed when we try to write this packet), + (write the packet then ensure the file descriptor fails), or @ ("lose" the packet then ensure the file descriptor fails). The sync and async peer-write functions hook this in automatically. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Header from folded patch 'test-run-cryptomsg__fix_compilation.patch': test/run-cryptomsg: fix compilation. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
31 lines
650 B
C
31 lines
650 B
C
#include <ccan/str/str.h>
|
|
#include <lightningd/debug.h>
|
|
#include <lightningd/dev_disconnect.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
void subdaemon_debug(int argc, char *argv[])
|
|
{
|
|
int i;
|
|
bool printed = false;
|
|
|
|
for (i = 1; i < argc; i++) {
|
|
if (strstarts(argv[i], "--dev-disconnect=")) {
|
|
dev_disconnect_init(atoi(argv[i]
|
|
+ strlen("--dev-disconnect=")));
|
|
}
|
|
}
|
|
|
|
/* From debugger, tell gdb "return". */
|
|
for (i = 1; i < argc; i++) {
|
|
while (streq(argv[i], "--debugger")) {
|
|
if (!printed)
|
|
fprintf(stderr, "gdb -ex 'attach %u' %s\n",
|
|
getpid(), argv[0]);
|
|
printed = true;
|
|
}
|
|
}
|
|
}
|