pub async fn serve<S, H>(
scheduler: &S,
listener: S::Socket,
handler: &H,
options: &Options,
cancellation: &Cancellation,
) -> Result<Statistics, Error>where
S: SocketAccept + SocketSetOption<TcpNoDelay> + SocketStreamReading + SocketStreamWriting + SocketClose,
S::Socket: 'static,
H: Handler,Expand description
Serve an already-bound listener with bounded concurrent connection futures. No hidden tasks or detached jobs are created. Cancellation stops acceptance, cancels active exchanges, joins retirement, and closes the owned listener. Individual peer/handler failures are counted without stopping other peers.