l2udptest_client: Improve code readability; only count valid data in statistics
All checks were successful
/ build-hamnet70 (push) Successful in 33s
/ build-doc (push) Successful in 16s
/ deploy-doc (push) Has been skipped

This commit is contained in:
Thomas Kolb 2025-01-04 16:16:39 +01:00
parent cea8145946
commit 176770eef5

View file

@ -408,10 +408,18 @@ int main(void)
bool tx_request_received = false;
result_t result = connection_handle_packet(&l2conn, packetbuf, ret, &data_packet, &tx_request_received);
may_tx = may_tx || tx_request_received;
// Switch to TX when a packet with tx_request=1 was decoded successfully.
// Note that this even triggers if the packet is out of sequence (but not for corrupted packets).
if(tx_request_received) {
may_tx = true;
}
switch(result) {
case OK:
// update statistics
m_rx_stats.successful_decodes++;
total_bytes += ret;
if(data_packet.payload_len != 0) {
rx_data_to_tun(&data_packet);
@ -436,8 +444,6 @@ int main(void)
break;
}
total_bytes += ret;
uint64_t new = get_hires_time();
if(new >= next_stats_print_time) {
double rate = total_bytes * 1e9 / (new - old);