Skip to main content

serve_with

Function serve_with 

Source
pub async fn serve_with(
    listener: TcpListener,
    app: Router,
    timeouts: Timeouts,
    shutdown: impl Future<Output = ()> + Send,
) -> Result<()>
Expand description

和 axum::serve(..).with_graceful_shutdown(..) 行为相同,另外给 HTTP/1 设了请求头读取超时 (axum::serve 设不了):收到 shutdown 后停止 accept,通知每个连接优雅关闭,等它们都结束再返回。