diff --git a/impl/test/layer2_over_udp/l2udptest_client.c b/impl/test/layer2_over_udp/l2udptest_client.c index 5a5e681..cccdcbc 100644 --- a/impl/test/layer2_over_udp/l2udptest_client.c +++ b/impl/test/layer2_over_udp/l2udptest_client.c @@ -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);