diff --git a/src/wifi/model/wifi-mac-queue-container.cc b/src/wifi/model/wifi-mac-queue-container.cc index bbe2ee18b..78c14a8a3 100644 --- a/src/wifi/model/wifi-mac-queue-container.cc +++ b/src/wifi/model/wifi-mac-queue-container.cc @@ -42,6 +42,7 @@ WifiMacQueueContainer::insert(const_iterator pos, Ptr item) NS_ABORT_MSG_UNLESS(pos == m_queues[queueId].cend() || GetQueueId(pos->mpdu) == queueId, "pos iterator does not point to the correct container queue"); + NS_ABORT_MSG_IF(!item->IsOriginal(), "Only the original copy of an MPDU can be inserted"); auto [it, ret] = m_nBytesPerQueue.insert({queueId, 0}); it->second += item->GetSize(); diff --git a/src/wifi/model/wifi-mac-queue.cc b/src/wifi/model/wifi-mac-queue.cc index 101952292..1eee1d3ec 100644 --- a/src/wifi/model/wifi-mac-queue.cc +++ b/src/wifi/model/wifi-mac-queue.cc @@ -248,7 +248,7 @@ WifiMacQueue::DequeueIfQueued(const std::list>& mpdus) { auto it = GetIt(mpdu); NS_ASSERT(it->ac == m_ac); - NS_ASSERT(it->mpdu == mpdu); + NS_ASSERT(it->mpdu == mpdu->GetOriginal()); iterators.emplace_back(it); } } @@ -374,7 +374,7 @@ WifiMacQueue::Remove(Ptr mpdu) NS_ASSERT(mpdu && mpdu->IsQueued()); auto it = GetIt(mpdu); NS_ASSERT(it->ac == m_ac); - NS_ASSERT(it->mpdu == mpdu); + NS_ASSERT(it->mpdu == mpdu->GetOriginal()); return DoRemove(it); } @@ -386,7 +386,7 @@ WifiMacQueue::Replace(Ptr currentItem, Ptr newItem) NS_ASSERT(currentItem->IsQueued()); auto currentIt = GetIt(currentItem); NS_ASSERT(currentIt->ac == m_ac); - NS_ASSERT(currentIt->mpdu == currentItem); + NS_ASSERT(currentIt->mpdu == currentItem->GetOriginal()); NS_ASSERT(!newItem->IsQueued()); Time expiryTime = currentIt->expiryTime; @@ -425,12 +425,12 @@ WifiMacQueue::DoEnqueue(ConstIterator pos, Ptr item) } auto queueId = WifiMacQueueContainer::GetQueueId(item); - if (pos != GetContainer().GetQueue(queueId).cend() && pos->mpdu == mpdu) + if (pos != GetContainer().GetQueue(queueId).cend() && mpdu && pos->mpdu == mpdu->GetOriginal()) { // the element pointed to by pos must be dropped; update insert position pos = std::next(pos); } - if (mpdu != nullptr) + if (mpdu) { DoRemove(GetIt(mpdu)); }