refactor: cleanup logging

This commit is contained in:
Jindřich Moravec 2024-01-27 20:03:36 +01:00
parent 9f3dbe3fdb
commit 08b10636c2

View file

@ -99,6 +99,8 @@ async fn create_token(tokens: &TokenStore) -> anyhow::Result<(i32, i32, ResetCan
} }
async fn handle_cancellation(pid: i32, key: i32, tokens: &TokenStore) -> anyhow::Result<()> { async fn handle_cancellation(pid: i32, key: i32, tokens: &TokenStore) -> anyhow::Result<()> {
println!("Cancel request, PID: {}, Key: {}", pid, key);
let tokens = tokens.lock().await; let tokens = tokens.lock().await;
let token = tokens.get(&(pid, key)); let token = tokens.get(&(pid, key));
match token { match token {
@ -114,19 +116,16 @@ where
R: FrontendProtoReader + Send, R: FrontendProtoReader + Send,
W: BackendProtoWriter + ProtoFlush + Send, W: BackendProtoWriter + ProtoFlush + Send,
{ {
println!("Handshake complete:\n{request:?}"); println!("Client connected: {:?}", request);
loop { loop {
println!("Waiting for next message");
let next: FrontendMessage = reader.read_proto().await?; let next: FrontendMessage = reader.read_proto().await?;
match next { match next {
FrontendMessage::Terminate => { FrontendMessage::Terminate => {
println!("Received Terminate");
break; break;
} }
FrontendMessage::Query(data) => { FrontendMessage::Query(data) => {
println!("Received Query: {:?}", data.query);
let result = handle_query(writer, &state, data.query.into(), &token).await; let result = handle_query(writer, &state, data.query.into(), &token).await;
match result { match result {
Ok(_) => {} Ok(_) => {}