From 8714bf903c21824f17c954be00b35f18fb7afc1b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 8 Apr 2021 15:46:49 +0930 Subject: [PATCH] subd: send versions at startup. For channeld, we move status_setup_sync() to a more obvious place. Signed-off-by: Rusty Russell --- channeld/channeld.c | 4 ++-- common/status.c | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/channeld/channeld.c b/channeld/channeld.c index 42cdfa61c..7f33b1a8c 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -3040,8 +3040,6 @@ static void init_channel(struct peer *peer) assert(!(fcntl(MASTER_FD, F_GETFL) & O_NONBLOCK)); - status_setup_sync(MASTER_FD); - msg = wire_sync_read(tmpctx, MASTER_FD); if (!fromwire_channeld_init(peer, msg, &chainparams, @@ -3225,6 +3223,8 @@ int main(int argc, char *argv[]) subdaemon_setup(argc, argv); + status_setup_sync(MASTER_FD); + peer = tal(NULL, struct peer); peer->expecting_pong = false; timers_init(&peer->timers, time_mono()); diff --git a/common/status.c b/common/status.c index c54944bb4..42612de05 100644 --- a/common/status.c +++ b/common/status.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,9 @@ void status_setup_sync(int fd) assert(!status_conn); status_fd = fd; setup_logging_sighandler(); + + /* Send version now. */ + status_send(take(towire_status_version(NULL, version()))); } static void destroy_daemon_conn(struct daemon_conn *dc UNUSED) @@ -75,6 +79,9 @@ void status_setup_async(struct daemon_conn *master) tal_add_destructor(master, destroy_daemon_conn); setup_logging_sighandler(); + + /* Send version now. */ + status_send(take(towire_status_version(NULL, version()))); } void status_send(const u8 *msg TAKES)