diff --git a/src/wifi/model/wifi-mac-queue.cc b/src/wifi/model/wifi-mac-queue.cc index 10eb971c6..7fee2442c 100644 --- a/src/wifi/model/wifi-mac-queue.cc +++ b/src/wifi/model/wifi-mac-queue.cc @@ -398,6 +398,17 @@ WifiMacQueue::Remove(Ptr mpdu) return DoRemove(it); } +void +WifiMacQueue::Flush() +{ + NS_LOG_FUNCTION(this); + + // there may be some expired MPDUs in the container queue storing MPDUs with expired lifetime, + // which will not be flushed by the Flush() method of the base class. + WipeAllExpiredMpdus(); + Queue::Flush(); +} + void WifiMacQueue::Replace(Ptr currentItem, Ptr newItem) { diff --git a/src/wifi/model/wifi-mac-queue.h b/src/wifi/model/wifi-mac-queue.h index 0e642cd6b..049541b22 100644 --- a/src/wifi/model/wifi-mac-queue.h +++ b/src/wifi/model/wifi-mac-queue.h @@ -212,6 +212,11 @@ class WifiMacQueue : public Queue */ Ptr Remove(Ptr item); + /** + * Flush the queue. + */ + void Flush(); + /** * Replace the given current item with the given new item. Actually, the current * item is dequeued and the new item is enqueued in its place. In this way,