mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-16 20:55:03 +01:00
connection working
This commit is contained in:
parent
ca1f372665
commit
13deef42fd
9 changed files with 217 additions and 82 deletions
|
|
@ -6,13 +6,15 @@ mod classes;
|
|||
mod connection;
|
||||
mod error;
|
||||
mod frame;
|
||||
mod sasl;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use crate::connection::Connection;
|
||||
use anyhow::Result;
|
||||
use tokio::net;
|
||||
use tracing::info;
|
||||
use tracing::{info, info_span, Instrument};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub async fn do_thing_i_guess() -> Result<()> {
|
||||
info!("Binding TCP listener...");
|
||||
|
|
@ -22,10 +24,13 @@ pub async fn do_thing_i_guess() -> Result<()> {
|
|||
loop {
|
||||
let (stream, _) = listener.accept().await?;
|
||||
|
||||
info!(local_addr = ?stream.local_addr(), "Accepted new connection");
|
||||
let id = Uuid::from_bytes(rand::random());
|
||||
|
||||
let connection = Connection::new(stream);
|
||||
info!(local_addr = ?stream.local_addr(), %id, "Accepted new connection");
|
||||
let span = info_span!("client-connection", %id);
|
||||
|
||||
tokio::spawn(connection.open_connection());
|
||||
let connection = Connection::new(stream, id);
|
||||
|
||||
tokio::spawn(connection.start_connection_processing().instrument(span));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue