add network test feature (PING/PONG with latency stats)

New frame types PING (0x0B) and PONG (0x0C), each carrying an 8-byte
nonce. Server echoes PING nonce verbatim in PONG. Client sends pings
at random 10-100ms intervals, correlates nonces to measure RTT.

Stats shown live: sent/recv counts, loss %, average latency, jitter
(mean absolute delta of consecutive RTTs). Test button toggles on/off.

Updated both Rust server (echo in main.rs) and C# client (PingTest.cs,
SessionManager routing, MainForm Test button + stats label).
This commit is contained in:
2026-08-13 08:28:59 +00:00
parent a2d3643d69
commit 279af33fd8
7 changed files with 242 additions and 4 deletions
+6 -1
View File
@@ -207,7 +207,12 @@ async fn handle_frame(
Frame::Close { session_id, reason: _ } => {
store.lock().expect("store poisoned").remove(&session_id);
}
Frame::Ping { nonce } => {
let pong = Frame::Pong { nonce };
let _ = tx.send((src, pong.encode())).await;
}
// Not expected from a client; ignore.
Frame::Manifest { .. } | Frame::OpenAck { .. } | Frame::OpenNak { .. } => {}
Frame::Manifest { .. } | Frame::OpenAck { .. } | Frame::OpenNak { .. }
| Frame::Pong { .. } => {}
}
}