fix: close daemon runtime cleanly

This commit is contained in:
Eric Wendland 2026-07-11 11:54:39 +02:00
commit 0efeabb225
2 changed files with 135 additions and 22 deletions

View file

@ -20,6 +20,13 @@ resource ID patterns, capabilities, and mutation or host-access points. Runtime
registries for pubsub, pipes, and overlays live behind narrow mutex-protected
structs in `runtime.rs`.
Daemon shutdown is an owned lifecycle transition, not process-exit cleanup.
After local control stops accepting requests, `daemon.rs` cancels the Iroh
accept and live-sync tasks, releases native docs/gossip/blob handles, calls
`Endpoint::close().await`, and removes the local control socket. The same
cleanup path runs when the serving loop returns an error, preventing stale
socket files and unclosed endpoint clones from becoming restart behavior.
The local metadata store is SQLite product state. `geth-store` tracks a numeric
`schema_version` in the `meta` table and applies ordered migrations up to the
crate's current schema version when the store opens. Fresh database creation and