From 959998752f197ffef7e69517ad99e6a2a488388a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 12 Nov 2023 10:33:55 +0100 Subject: [PATCH] wifi: Move code to clear RX events to AbortCurrentReception function --- src/wifi/model/wifi-phy.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 77c3afe11..b5c2ced02 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -1789,13 +1789,6 @@ WifiPhy::Send(WifiConstPsduMap psdus, const WifiTxVector& txVector) AbortCurrentReception(RECEPTION_ABORTED_BY_TX); } - for (auto& it : m_phyEntities) - { - it.second->CancelRunningEndPreambleDetectionEvents(); - } - m_currentPreambleEvents.clear(); - m_endPhyRxEvent.Cancel(); - if (m_powerRestricted) { NS_LOG_DEBUG("Transmitting with power restriction for " << txDuration.As(Time::NS)); @@ -2146,12 +2139,20 @@ WifiPhy::AbortCurrentReception(WifiPhyRxfailureReason reason) { m_state->SwitchFromRxAbort(GetChannelWidth()); } - for (auto it = m_currentPreambleEvents.begin(); it != m_currentPreambleEvents.end(); ++it) + if (reason == RECEPTION_ABORTED_BY_TX) { - if (it->second == m_currentEvent) + m_currentPreambleEvents.clear(); + } + else + { + for (auto it = m_currentPreambleEvents.begin(); it != m_currentPreambleEvents.end(); + ++it) { - it = m_currentPreambleEvents.erase(it); - break; + if (it->second == m_currentEvent) + { + it = m_currentPreambleEvents.erase(it); + break; + } } } m_currentEvent = nullptr;