connectd: give subds a chance to drain when lightningd says to disconnect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-10-22 14:37:31 +10:30
parent a32b3b68e2
commit 798cf27cb4
3 changed files with 8 additions and 2 deletions

View File

@ -1812,8 +1812,10 @@ static void peer_discard(struct daemon *daemon, const u8 *msg)
/* If it's reconnected already, it will learn soon. */
if (peer->counter != counter)
return;
/* We make sure any final messages from the subds are sent! */
status_peer_debug(&id, "discard_peer");
tal_free(peer);
drain_peer(peer);
}
static void start_shutdown(struct daemon *daemon, const u8 *msg)

View File

@ -108,7 +108,7 @@ static void close_subd_timeout(struct subd *subd)
io_close(subd->conn);
}
static void drain_peer(struct peer *peer)
void drain_peer(struct peer *peer)
{
status_debug("drain_peer");
assert(!peer->draining);

View File

@ -34,4 +34,8 @@ void send_custommsg(struct daemon *daemon, const u8 *msg);
/* Lightningd wants to talk to you. */
void peer_connect_subd(struct daemon *daemon, const u8 *msg, int fd);
/* Start shutting down peer. */
void drain_peer(struct peer *peer);
#endif /* LIGHTNING_CONNECTD_MULTIPLEX_H */