haesli/amqp_transport/src/lib.rs
2022-02-13 21:44:52 +01:00

29 lines
674 B
Rust

#![allow(dead_code)]
extern crate core;
mod classes;
mod connection;
mod error;
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.open_connection());
}
}