More debugging to remote server...
This commit is contained in:
parent
93403d781b
commit
351e301293
2 changed files with 15 additions and 10 deletions
|
|
@ -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<Option<ClientFrames>> {
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(());
|
||||
|
|
|
|||
Loading…
Reference in a new issue