lightningd: enable io logging on subdaemons iff we're going to print it.

This simplifies our tests, too, since we don't need a magic option to
enable io logging in subdaemons.

Note that test_bad_onion still takes too long, due to a separate minor
bug, so that's marked and left dev-only for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-11-18 10:57:17 +10:30
parent 0607f998d1
commit 4fc498f901
7 changed files with 40 additions and 52 deletions

View File

@@ -18,7 +18,7 @@
static int status_fd = -1;
static struct daemon_conn *status_conn;
volatile bool logging_io = false;
static bool was_logging_io = false;
static bool was_logging_io;
/* If we're more than this many msgs deep, don't add debug messages. */
#define TRACE_QUEUE_LIMIT 20
@@ -33,6 +33,9 @@ static void setup_logging_sighandler(void)
{
struct sigaction act;
/* Could have been set to true by --log-io arg. */
was_logging_io = logging_io;
memset(&act, 0, sizeof(act));
act.sa_handler = got_sigusr1;
act.sa_flags = SA_RESTART;
@@ -55,10 +58,6 @@ void status_setup_sync(int fd)
assert(!status_conn);
status_fd = fd;
setup_logging_sighandler();
#if DEVELOPER
logging_io = (getenv("LIGHTNINGD_DEV_LOG_IO") != NULL);
report_logging_io("LIGHTNINGD_DEV_LOG_IO");
#endif
}
static void destroy_daemon_conn(struct daemon_conn *dc UNUSED)
@@ -75,10 +74,6 @@ void status_setup_async(struct daemon_conn *master)
tal_add_destructor(master, destroy_daemon_conn);
setup_logging_sighandler();
#if DEVELOPER
logging_io = (getenv("LIGHTNINGD_DEV_LOG_IO") != NULL);
report_logging_io("LIGHTNINGD_DEV_LOG_IO");
#endif
}
void status_send(const u8 *msg TAKES)