From 2c10c442300a04e353cb3e08a9dadab4591c577e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Courageux-sudan?= Date: Mon, 22 Apr 2024 11:39:47 +0200 Subject: [PATCH] proposition to fix #163 --- model/end-device-lorawan-mac.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/model/end-device-lorawan-mac.cc b/model/end-device-lorawan-mac.cc index c569c5e435..0769d8b4d7 100644 --- a/model/end-device-lorawan-mac.cc +++ b/model/end-device-lorawan-mac.cc @@ -198,7 +198,15 @@ EndDeviceLorawanMac::postponeTransmission(Time netxTxDelay, Ptr packet) NS_LOG_FUNCTION(this); // Delete previously scheduled transmissions if any. Simulator::Cancel(m_nextTx); - m_nextTx = Simulator::Schedule(netxTxDelay, &EndDeviceLorawanMac::DoSend, this, packet); + EventId eid = Simulator::Schedule(netxTxDelay, &EndDeviceLorawanMac::Send, this, packet); + // Checking if this is the transmission of a new packet + if (packet == m_retxParams.packet) + { + m_nextTx = eid; + } // this is not a retransmission + else { + m_nextTx = EventId(); + } NS_LOG_WARN("Attempting to send, but the aggregate duty cycle won't allow it. Scheduling a tx " "at a delay " << netxTxDelay.GetSeconds() << "."); @@ -619,6 +627,7 @@ EndDeviceLorawanMac::Shuffle(std::vector> vector) void EndDeviceLorawanMac::resetRetransmissionParameters() { + NS_LOG_FUNCTION(this); m_retxParams.waitingAck = false; m_retxParams.retxLeft = m_maxNumbTx; m_retxParams.packet = nullptr;