From 0c14e6cf5bbed8e661c8c79692ff2a9ebb302ca8 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Tue, 31 Mar 2026 19:39:28 +0400 Subject: [PATCH] Fix UDP TX-only status: report tx_bytes instead of rx_bytes In TX-only mode (MikroTik receives), we sent rx_bytes=0 in status because we weren't receiving anything. But MikroTik client needs to see non-zero bytes in the status to know data is flowing. Now report tx_bytes when in TX-only mode. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/server.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/server.rs b/src/server.rs index 51d00ed..be930b8 100644 --- a/src/server.rs +++ b/src/server.rs @@ -949,9 +949,17 @@ async fn udp_status_loop( let tx_bytes = state.tx_bytes.swap(0, Ordering::Relaxed); let lost = state.rx_lost_packets.swap(0, Ordering::Relaxed); + // Report bytes relevant to the active direction. + // When TX-only: report tx_bytes so client knows data is flowing. + // When RX or BOTH: report rx_bytes (how much we received from client). + let report_bytes = if cmd.server_tx() && !cmd.server_rx() { + tx_bytes + } else { + rx_bytes + }; let status = StatusMessage { seq, - bytes_received: rx_bytes as u32, + bytes_received: report_bytes as u32, }; let serialized = status.serialize(); tracing::debug!(