Module kvarn::shutdown

source ·
Expand description

Graceful shutdown for Kvarn.

This is handled through a Manager and several helper structs. The Manager is returned from RunConfig::execute and can be awaited to pause execution till the server is shut down. It is also used to trigger a shutdown.


  • A wrapper around TcpListener (and UdpListener when HTTP/3 comes around) which waits for a new connection or a shutdown signal.
  • Shutdown manager. Contains a counter of connections and a shutdown flag to determine when to initiate a shutdown.


  • The result of AcceptManager::accept. Can either be a new connection or a shutdown signal. The listener should be dropped right after the shutdown signal is received.