From 1c320d7d07dfea2eaf38964d57886e806b49532b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 11 Nov 2023 17:59:48 +0100 Subject: [PATCH] wifi: Preamble detection events are always cleared when canceled --- src/wifi/model/phy-entity.cc | 17 +++++------------ src/wifi/model/phy-entity.h | 6 ++---- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 8933f8c4c..e30af9345 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -999,7 +999,7 @@ PhyEntity::EndPreambleDetectionPeriod(Ptr event) // A bit convoluted but it enables to sync all PHYs for (auto& it : m_wifiPhy->m_phyEntities) { - it.second->CancelRunningEndPreambleDetectionEvents(true); + it.second->CancelRunningEndPreambleDetectionEvents(); } for (auto it = m_wifiPhy->m_currentPreambleEvents.begin(); @@ -1089,11 +1089,7 @@ void PhyEntity::CancelAllEvents() { NS_LOG_FUNCTION(this); - for (auto& endPreambleDetectionEvent : m_endPreambleDetectionEvents) - { - endPreambleDetectionEvent.Cancel(); - } - m_endPreambleDetectionEvents.clear(); + CancelRunningEndPreambleDetectionEvents(); for (auto& endRxPayloadEvent : m_endRxPayloadEvents) { endRxPayloadEvent.Cancel(); @@ -1113,17 +1109,14 @@ PhyEntity::NoEndPreambleDetectionEvents() const } void -PhyEntity::CancelRunningEndPreambleDetectionEvents(bool clear /* = false */) +PhyEntity::CancelRunningEndPreambleDetectionEvents() { - NS_LOG_FUNCTION(this << clear); + NS_LOG_FUNCTION(this); for (auto& endPreambleDetectionEvent : m_endPreambleDetectionEvents) { endPreambleDetectionEvent.Cancel(); } - if (clear) - { - m_endPreambleDetectionEvents.clear(); - } + m_endPreambleDetectionEvents.clear(); } void diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index 8160e66bd..bbefd4a68 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -437,11 +437,9 @@ class PhyEntity : public SimpleRefCount */ bool NoEndPreambleDetectionEvents() const; /** - * Cancel and eventually clear all end preamble detection events. - * - * \param clear whether to clear the end preamble detection events' list + * Cancel all end preamble detection events. */ - void CancelRunningEndPreambleDetectionEvents(bool clear = false); + void CancelRunningEndPreambleDetectionEvents(); /** * Return the STA ID that has been assigned to the station this PHY belongs to.