Expand description
The shutdown signal, from the process down to each connection.
Graceful shutdown of a proxy is not “stop the process”: every open tunnel is somebody’s TCP connection or UDP flow, and dropping them all at once is visible to the user as a burst of broken pages and dead calls. RFC 9114 §5.2 provides the polite version, and the sequence the server implements is:
- stop accepting new QUIC connections;
- send a GOAWAY on every live HTTP/3 connection, which tells the client to take its new requests elsewhere while the ones in flight finish;
- wait for the tunnels to end on their own, up to
server.shutdown_grace; - close the endpoint regardless, so a stuck tunnel cannot hold the process open forever;
- stop the runtime, waiting no longer than
blocking_gracefor the blocking tasks that are still running.
This module is mostly the signal: a one-way latch that many tasks can wait on
and that never un-fires, so a task arriving late still observes it. Steps 1, 3
and 4 live in crate::quic; step 2 lives in crate::conn; step 5 is
stop_runtime here, called by the binary once the runtime’s own work is
done.
Structs§
- Shutdown
- Observes the shutdown signal.
- Trigger
- Fires the shutdown signal. Cheap to clone; any clone can fire it.
Constants§
- EXIT_
SLACK - The margin
blocking_graceadds on top of the shutdown budget.
Functions§
- blocking_
grace - How long the blocking pool gets once the runtime’s own work is over.
- channel
- Creates a fresh signal, unfired.
- stop_
runtime - Stops
runtime, waiting at mostblocking_gracefor its blocking tasks.