Skip to main content

start_server

Function start_server 

Source
pub async fn start_server(config: Config, token: String) -> Result<(u64, u64)>
Expand description

Start the daemon HTTP server and run until a shutdown signal is received.

Binds to 127.0.0.1:{config.port}. The server shuts down gracefully on:

  • SIGTERM (Unix) or Ctrl+C (all platforms)
  • HTTP POST /shutdown (authenticated)

After shutdown, prints a summary to stderr and waits for the event logger to drain.

§Errors

Returns an error if the TCP listener cannot be bound (e.g., port in use).