diff --git a/src/network/utils/net-device-queue-interface.cc b/src/network/utils/net-device-queue-interface.cc index 2382119ab..32b40644e 100644 --- a/src/network/utils/net-device-queue-interface.cc +++ b/src/network/utils/net-device-queue-interface.cc @@ -22,7 +22,6 @@ #include "ns3/abort.h" #include "ns3/queue-item.h" #include "ns3/queue-limits.h" -#include "ns3/simulator.h" #include "ns3/uinteger.h" namespace ns3 @@ -89,7 +88,7 @@ NetDeviceQueue::Wake() // Request the queue disc to dequeue a packet if (wasStoppedByDevice && !m_wakeCallback.IsNull()) { - Simulator::ScheduleNow(&NetDeviceQueue::m_wakeCallback, this); + m_wakeCallback(); } } @@ -142,7 +141,7 @@ NetDeviceQueue::NotifyTransmittedBytes(uint32_t bytes) // Request the queue disc to dequeue a packet if (wasStoppedByQueueLimits && !m_wakeCallback.IsNull()) { - Simulator::ScheduleNow(&NetDeviceQueue::m_wakeCallback, this); + m_wakeCallback(); } } diff --git a/src/network/utils/net-device-queue-interface.h b/src/network/utils/net-device-queue-interface.h index b4efb6d51..ea2eeea9e 100644 --- a/src/network/utils/net-device-queue-interface.h +++ b/src/network/utils/net-device-queue-interface.h @@ -25,6 +25,7 @@ #include "ns3/object-factory.h" #include "ns3/object.h" #include "ns3/ptr.h" +#include "ns3/simulator.h" #include #include @@ -361,19 +362,21 @@ void NetDeviceQueue::PacketDequeued(QueueType* queue, Ptr item) { NS_LOG_FUNCTION(this << queue << item); - - // Inform BQL - NotifyTransmittedBytes(item->GetSize()); - NS_ASSERT_MSG(m_device, "Aggregated NetDevice not set"); - // After dequeuing a packet, if there is room for another packet we - // call Wake () that ensures that the queue is not stopped and restarts - // the queue disc if the queue was stopped - if (!queue->WouldOverflow(1, m_device->GetMtu())) - { - Wake(); - } + Simulator::ScheduleNow([=]() { + // Inform BQL + NotifyTransmittedBytes(item->GetSize()); + + // After dequeuing a packet, if there is room for another packet we + // call Wake () that ensures that the queue is not stopped and restarts + // the queue disc if the queue was stopped + + if (!queue->WouldOverflow(1, m_device->GetMtu())) + { + Wake(); + } + }); } template