Add Windows named-pipe local control

This commit is contained in:
Eric Wendland 2026-07-18 17:05:38 +02:00
commit 3c84713472
9 changed files with 338 additions and 72 deletions

View file

@ -3,11 +3,11 @@
`geth` is a single-binary local-first mesh runtime. One executable provides both
daemon mode and control mode. The daemon owns local identity, metadata storage,
the shared Iroh endpoint, resource registry, module routing, and local control
socket. Control commands connect to the Unix socket and send typed JSONL
requests.
endpoint. Control commands connect to a per-home Unix socket on Linux/macOS or
a per-home named pipe on Windows and send typed JSONL requests.
Within `geth-node`, daemon lifecycle code is separated from feature handlers:
`daemon.rs` owns `geth daemon run` startup, local socket binding, shutdown
`daemon.rs` owns `geth daemon run` startup, local endpoint binding, shutdown
signal handling, Iroh endpoint startup, the Iroh accept loop, and background
live-sync task spawning. `local_control.rs` owns async local `ControlRequest`
routing, safe trace-field classification, and named peer/resource/local handler
@ -28,9 +28,11 @@ as stale and replaced. This keeps one daemon authoritative for each geth home
and prevents a second process from unlinking the first daemon's control path.
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.
`Endpoint::close().await`, and releases the local control endpoint. On Unix this
also removes the socket path; Windows named pipes disappear with their server
handles. The same cleanup path runs when the serving loop returns an error,
preventing stale endpoints and unclosed endpoint clones from becoming restart
behavior.
Foreground daemons handle Ctrl-C, and Unix daemons also handle the SIGTERM used
by user service managers, through this same graceful shutdown path.