From 3068db1d507d44a5f4d65cbff6cd8c7a1699f9bd Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sat, 20 Jul 2024 01:04:03 +0200 Subject: [PATCH] Handle retransmit timeouts --- impl/src/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/impl/src/main.c b/impl/src/main.c index c6096c9..5b61f87 100644 --- a/impl/src/main.c +++ b/impl/src/main.c @@ -227,9 +227,17 @@ int main(int argc, char **argv) size_t total_samples = 0; double next_stats_print_time = old + 0.5; + double retransmit_time = 0.0; + while(m_running) { double now = get_hires_time(); + if(retransmit_time != 0.0 && now >= retransmit_time) { + LOG(LVL_INFO, "Retransmit triggered."); + retransmit_time = 0.0; + layer2_tx_restart(&l2tx); + } + // fill the TX queue from the TUN device layer2_tx_fill_packet_queue(&l2tx); @@ -285,6 +293,8 @@ int main(int argc, char **argv) // ensure that the buffer is full before TX is turned on to avoid transmitting empty buffers RESULT_CHECK(transmit(&sdr, whole_burst, burst_len)); + retransmit_time = get_hires_time() + 4.0; + if(!on_air) { LOG(LVL_INFO, "RX -> TX"); RESULT_CHECK(sdr_stop_rx(&sdr)); @@ -296,7 +306,7 @@ int main(int argc, char **argv) } on_air = true; - } else if(on_air) { // ret == 0 + } else if(on_air) { // TX on, but no more bursts to send LOG(LVL_INFO, "TX -> RX"); RESULT_CHECK(sdr_flush_tx_buffer(&sdr)); RESULT_CHECK(layer1_rx_reset(&rx));