Connection Handler
async fn handle_conn(
stream: TcpStream,
addr: SocketAddr,
_permit: OwnedSemaphorePermit,
) {
let result = timeout(
Duration::from_secs(30),
echo_lines(stream, addr),
).await;
match result {
Ok(Ok(bytes)) => info!(%addr, bytes, "connection closed"),
Ok(Err(e)) => error!(%addr, %e, "connection error"),
Err(_) => info!(%addr, "connection timed out"),
}
}