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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-06-30 04:53:17 +09:30
parent 04f485aee0
commit 9bc1a020d0

View File

@ -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. */