Skip to content

Commit aca010e

Browse files
debug: Added print statements from debugging
1 parent 17a2ab3 commit aca010e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

server/src/handlers/client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ pub async fn handle_client(
2121

2222
let (name, session_key, public_key) = match perform_handshake(rd.clone(), wt.clone()).await {
2323
Ok(data) => data,
24-
Err(_) => return,
24+
Err(e) => {
25+
eprintln!("❗️ Handshake failed: {:?}", e);
26+
return;
27+
}
2528
};
2629

2730
let client_id = public_key_to_user_id(&public_key);

server/src/net.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub async fn perform_handshake(
2121
// Receive handshake packet from client with username and public_key
2222
let packet: HandshakePacket = read_packet(rd.clone()).await?;
2323
if packet.step != 0 {
24+
eprintln!("❗️ Invalid handshake step: expected 0, got {}", packet.step);
2425
let _ = close_connection(wt.clone(), "Invalid handshake step").await;
2526
return Err("Invalid handshake step".into());
2627
}
@@ -52,6 +53,7 @@ pub async fn perform_handshake(
5253
// Receive signature and verify it
5354
let packet: HandshakePacket = read_packet(rd.clone()).await?;
5455
if packet.step != 2 {
56+
eprintln!("❗️ Invalid handshake step: expected 2, got {}", packet.step);
5557
let _ = close_connection(wt.clone(), "Invalid handshake step").await;
5658
return Err("Invalid handshake step".into());
5759
}
@@ -61,6 +63,7 @@ pub async fn perform_handshake(
6163
};
6264

6365
if !verify_nonce_signature(&public_key, &nonce, &signature) {
66+
eprintln!("❗️ Invalid signature!");
6467
let _ = close_connection(wt.clone(), "Invalid signature!").await;
6568
return Err("Invalid signature!".into());
6669
}

0 commit comments

Comments
 (0)