More debugging to remote server...

This commit is contained in:
Bastian Gruber 2023-05-21 17:50:33 +02:00
parent 93403d781b
commit 351e301293
No known key found for this signature in database
GPG key ID: BE9F8C772B188CBF
2 changed files with 15 additions and 10 deletions

View file

@ -6,6 +6,8 @@ use tokio::{
net::TcpStream, net::TcpStream,
}; };
use tracing::info;
use crate::frame::{self, ClientFrames, ServerFrames}; use crate::frame::{self, ClientFrames, ServerFrames};
pub(crate) enum ConnectionType { pub(crate) enum ConnectionType {
@ -34,8 +36,11 @@ impl Connection {
} }
pub async fn read_frame(&mut self) -> crate::Result<Option<ClientFrames>> { pub async fn read_frame(&mut self) -> crate::Result<Option<ClientFrames>> {
info!("Start read_frame");
loop { loop {
info!("Looping to self.parse_frame");
if let Some(frame) = self.parse_frame()? { if let Some(frame) = self.parse_frame()? {
info!("parse_frame got a result: {frame:?}");
return Ok(Some(frame)); return Ok(Some(frame));
} }

View file

@ -135,6 +135,7 @@ impl Handler {
while !self.shutdown.is_shutdown() { while !self.shutdown.is_shutdown() {
tokio::select! { tokio::select! {
res = self.connection.read_frame() => { res = self.connection.read_frame() => {
info!("Reading from frame: {res:?}");
match res? { match res? {
Some(frame) => { Some(frame) => {
info!("Received frame"); info!("Received frame");
@ -142,17 +143,16 @@ impl Handler {
}, },
None => return Ok(()), None => return Ok(()),
} }
} }
// message = receive_message.recv() => { message = receive_message.recv() => {
// info!("Received a message through the channel"); info!("Reading from channel: {message:?}");
// match message { match message {
// Some(message) => { Some(message) => {
// let _ = self.connection.write_frame(message).await; let _ = self.connection.write_frame(message).await;
// }, },
// None => (), None => (),
// } }
// } }
_ = self.shutdown.recv() => { _ = self.shutdown.recv() => {
debug!("Shutdown"); debug!("Shutdown");
return Ok(()); return Ok(());