Skip to main content

handle_connection

Function handle_connection 

Source
pub async fn handle_connection<S>(
    stream: S,
    router: Arc<Router>,
    auth: ServerAuth,
) -> Result<(), ConnectionError>
where S: AsyncRead + AsyncWrite + Unpin + Send + 'static,
Expand description

Run the authenticated frame read -> route loop for one connection.

Every accepted TCP connection must complete the key-auth prelude before any envelope bytes are read by the router. Outbound frames flow through a bounded FrameSink drained by one writer task. Inbound dispatch remains serial for every frame except route.open; only that bind wait runs in a connection-owned task so it cannot hold unrelated frames behind a slow target module.