ipc: Avoid waiting for clients to disconnect when shutting down

This fixes behavior reported by Antoine Poinsot <darosior@protonmail.com>
https://github.com/bitcoin/bitcoin/pull/29409#issuecomment-2546088852 where if
an IPC client is connected, the node will wait forever for it to disconnect
before exiting.
This commit is contained in:
Ryan Ofsky
2025-04-24 15:02:19 -04:00
parent 6eb09fd614
commit 7f65aac78b
5 changed files with 29 additions and 0 deletions

View File

@@ -374,6 +374,12 @@ void Shutdown(NodeContext& node)
client->stop();
}
// If any -ipcbind clients are still connected, disconnect them now so they
// do not block shutdown.
if (interfaces::Ipc* ipc = node.init->ipc()) {
ipc->disconnectIncoming();
}
#ifdef ENABLE_ZMQ
if (g_zmq_notification_interface) {
if (node.validation_signals) node.validation_signals->UnregisterValidationInterface(g_zmq_notification_interface.get());