From 9bc1a020d0c4914a394fe99f175c772631221c1d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 30 Jun 2023 04:53:17 +0930 Subject: [PATCH] connectd: don't try to keep going if gossipd dies. We will access the freed connection to gossipd. This is weird to track down when the *actual* issue is that gossipd died! Signed-off-by: Rusty Russell --- connectd/connectd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/connectd/connectd.c b/connectd/connectd.c index 585d1cdeb..6d78a26ac 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -2161,6 +2161,11 @@ static void memleak_daemon_cb(struct htable *memtable, struct daemon *daemon) } #endif /* DEVELOPER */ +static void gossipd_failed(struct daemon_conn *gossipd) +{ + status_failed(STATUS_FAIL_GOSSIP_IO, "gossipd exited?"); +} + int main(int argc, char *argv[]) { setup_locale(); @@ -2199,6 +2204,7 @@ int main(int argc, char *argv[]) daemon->gossipd = daemon_conn_new(daemon, GOSSIPCTL_FD, recv_gossip, NULL, daemon); + tal_add_destructor(daemon->gossipd, gossipd_failed); /* Set up ecdh() function so it uses our HSM fd, and calls * status_failed on error. */