diff --git a/problem_06/src/connection.rs b/problem_06/src/connection.rs index 4267a6f..19750c8 100644 --- a/problem_06/src/connection.rs +++ b/problem_06/src/connection.rs @@ -6,6 +6,8 @@ use tokio::{ net::TcpStream, }; +use tracing::info; + use crate::frame::{self, ClientFrames, ServerFrames}; pub(crate) enum ConnectionType { @@ -34,8 +36,11 @@ impl Connection { } pub async fn read_frame(&mut self) -> crate::Result> { + info!("Start read_frame"); loop { + info!("Looping to self.parse_frame"); if let Some(frame) = self.parse_frame()? { + info!("parse_frame got a result: {frame:?}"); return Ok(Some(frame)); } diff --git a/problem_06/src/server.rs b/problem_06/src/server.rs index c2fc392..36897e5 100644 --- a/problem_06/src/server.rs +++ b/problem_06/src/server.rs @@ -135,6 +135,7 @@ impl Handler { while !self.shutdown.is_shutdown() { tokio::select! { res = self.connection.read_frame() => { + info!("Reading from frame: {res:?}"); match res? { Some(frame) => { info!("Received frame"); @@ -142,17 +143,16 @@ impl Handler { }, None => return Ok(()), } - } - // message = receive_message.recv() => { - // info!("Received a message through the channel"); - // match message { - // Some(message) => { - // let _ = self.connection.write_frame(message).await; - // }, - // None => (), - // } - // } + message = receive_message.recv() => { + info!("Reading from channel: {message:?}"); + match message { + Some(message) => { + let _ = self.connection.write_frame(message).await; + }, + None => (), + } + } _ = self.shutdown.recv() => { debug!("Shutdown"); return Ok(());