From 79286b20e5f7a22ff15a38acf84db9abf3649aee Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Sun, 27 Nov 2022 23:09:29 +0100 Subject: [PATCH] wifi: Call expired traced callback when the current flow of operations complete ...to avoid nested calls to ExtractExpiredMpdus while enqueuing/dequeuing frames. --- src/wifi/model/wifi-mac-queue.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/wifi/model/wifi-mac-queue.cc b/src/wifi/model/wifi-mac-queue.cc index 39663451e..812e899c5 100644 --- a/src/wifi/model/wifi-mac-queue.cc +++ b/src/wifi/model/wifi-mac-queue.cc @@ -111,11 +111,17 @@ WifiMacQueue::ExtractExpiredMpdus(const WifiContainerQueueId& queueId) const for (auto it = first; it != last; it++) { mpdus.push_back(it->mpdu); + } + for (const auto& mpdu : mpdus) + { // fire the Expired trace - m_traceExpired(it->mpdu); + Simulator::ScheduleNow(&WifiMacQueue::m_traceExpired, this, mpdu); } // notify the scheduler - m_scheduler->NotifyRemove(m_ac, mpdus); + if (!mpdus.empty()) + { + m_scheduler->NotifyRemove(m_ac, mpdus); + } } void @@ -129,11 +135,17 @@ WifiMacQueue::ExtractAllExpiredMpdus() const for (auto it = first; it != last; it++) { mpdus.push_back(it->mpdu); + } + for (const auto& mpdu : mpdus) + { // fire the Expired trace - m_traceExpired(it->mpdu); + Simulator::ScheduleNow(&WifiMacQueue::m_traceExpired, this, mpdu); } // notify the scheduler - m_scheduler->NotifyRemove(m_ac, mpdus); + if (!mpdus.empty()) + { + m_scheduler->NotifyRemove(m_ac, mpdus); + } } void