mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-14 19:55:03 +01:00
23 lines
598 B
Rust
23 lines
598 B
Rust
mod connection;
|
|
mod frame;
|
|
|
|
use crate::connection::Connection;
|
|
use anyhow::Result;
|
|
use tokio::net;
|
|
use tracing::info;
|
|
|
|
pub async fn do_thing_i_guess() -> Result<()> {
|
|
info!("Binding TCP listener...");
|
|
let listener = net::TcpListener::bind(("127.0.0.1", 5672)).await?;
|
|
info!(addr = ?listener.local_addr()?, "Successfully bound TCP listener");
|
|
|
|
loop {
|
|
let (stream, _) = listener.accept().await?;
|
|
|
|
info!(local_addr = ?stream.local_addr(), "Accepted new connection");
|
|
|
|
let connection = Connection::new(stream);
|
|
|
|
tokio::spawn(connection.start());
|
|
}
|
|
}
|