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:
+14
@@ -46,6 +46,8 @@ emitted in v1.
|
||||
| 0x05 | OPEN_NAK | S → C | 0 | `upstream_id:1, reason:1` |
|
||||
| 0x06 | DATA | both | session | raw bytes (≤1480) |
|
||||
| 0x07 | CLOSE | both | session | optional `reason:1` |
|
||||
| 0x0B | PING | C → S | 0 | `nonce:8` |
|
||||
| 0x0C | PONG | S → C | 0 | `nonce:8` (echoed) |
|
||||
|
||||
Reserved (unimplemented in v1; parse returns Err, encode unimplemented):
|
||||
|
||||
@@ -140,6 +142,18 @@ field identifies which session the bytes belong to.
|
||||
|
||||
- **reason** (u8, optional): present iff payload length ≥ 1. See reason codes.
|
||||
|
||||
### PING / PONG payload
|
||||
|
||||
```
|
||||
+ +
|
||||
| nonce (big-endian, 8 bytes) |
|
||||
+ +
|
||||
```
|
||||
|
||||
- **nonce** (u64, big-endian): arbitrary value chosen by the client. The
|
||||
server echoes it verbatim in the PONG reply. Used to correlate RTT
|
||||
measurements.
|
||||
|
||||
## Reason codes
|
||||
|
||||
| Value | Meaning |
|
||||
|
||||
Reference in New Issue
Block a user