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, activity operations and privileged requests; their bind, file and operator waits run in connection-owned tasks so unrelated frames can keep flowing.