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) <noreply@anthropic.com>
This commit is contained in:
@@ -949,9 +949,17 @@ async fn udp_status_loop(
|
|||||||
let tx_bytes = state.tx_bytes.swap(0, Ordering::Relaxed);
|
let tx_bytes = state.tx_bytes.swap(0, Ordering::Relaxed);
|
||||||
let lost = state.rx_lost_packets.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 {
|
let status = StatusMessage {
|
||||||
seq,
|
seq,
|
||||||
bytes_received: rx_bytes as u32,
|
bytes_received: report_bytes as u32,
|
||||||
};
|
};
|
||||||
let serialized = status.serialize();
|
let serialized = status.serialize();
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
|
|||||||
Reference in New Issue
Block a user