pub async fn run_http(
router: Router,
sessions: Arc<SessionRegistry>,
port: u16,
) -> Result<()>Expand description
Bind a TcpListener and serve POST /rpc + GET /health +
GET /sessions/{id}/events until SIGTERM/SIGINT (graceful) or an
internal axum error.
Why: the top-level entry point crate::serve::run_http delegates to this
once the router and session registry are assembled.
What: binds 127.0.0.1:port (port = 0 lets the OS assign an ephemeral
port), logs the real bound address to stderr — mirroring
trusty-memory’s run_http_on, and never touching stdout — then serves
with trusty_common::shutdown_signal() installed via
with_graceful_shutdown: SIGTERM/SIGINT stop new connections and drain
in-flight requests before this function returns (issue #534 convention).
Test: not directly unit-tested (would require a real socket + a real
signal); build_axum_router’s tests cover the routing/dispatch logic
this serves.