lightningd: more graceful shutdown.

Be more graceful in shutting down: this should fix the issue where
bookkeeper gets upset that its commands are rejected during shutdown,
and generally make things more graceful.

1. Stop any new RPC connections.
2. Stop any per-peer daemons (channeld, etc).
3. Shut down plugins.
4. Stop all existing RPC connections.
5. Stop global daemons.
6. Free up peer, chanen HTLC datastructures.
7. Close database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Plugins: RPC operations are now still available during shutdown.
This commit is contained in:
Rusty Russell
2022-09-11 17:21:18 +09:30
committed by Christian Decker
parent e853cdc3ff
commit 375215a141
11 changed files with 81 additions and 54 deletions

View File

@@ -167,7 +167,8 @@ static void plugin_hook_callback(const char *buffer, const jsmntok_t *toks,
tal_del_destructor(last, plugin_hook_killed);
tal_free(last);
if (r->ld->state == LD_STATE_SHUTDOWN) {
/* Actually, if it dies during shutdown, *don't* process result! */
if (!buffer && r->ld->state == LD_STATE_SHUTDOWN) {
log_debug(r->ld->log,
"Abandoning plugin hook call due to shutdown");
return;