Skip to main content

serve

Function serve 

Source
pub async fn serve(control: Arc<Control>, listener: TcpListener) -> Result<()>
Expand description

Serve the fast path on an already-bound listener until it errors unrecoverably. Each accepted connection is handled on its own task; the protocol is HTTP/1.1, or HTTP/2 when TLS-ALPN negotiates h2 (ADR 000015). A per-connection error is logged, not fatal. Bind with TcpListener::bind (the caller picks the addr, so a test can use an ephemeral 127.0.0.1:0 and read local_addr).

Public boundary stays anyhow::Result (bp-rust: typed errors are a library-internal convention, not a public-API commitment) — the internal ServerError is pub(crate), so a caller in another crate could not even name it. serve_inner does the typed work.