From 849700282aaf8c754c8a44e0fa8bba98987f9bf8 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Wed, 20 Sep 2023 03:19:39 +0100 Subject: [PATCH] traffic-control: Change return type of RedQueueDisc::DropEarly() from uint32_t to bool --- src/traffic-control/model/red-queue-disc.cc | 8 ++++---- src/traffic-control/model/red-queue-disc.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/traffic-control/model/red-queue-disc.cc b/src/traffic-control/model/red-queue-disc.cc index b6372745c..187a31659 100644 --- a/src/traffic-control/model/red-queue-disc.cc +++ b/src/traffic-control/model/red-queue-disc.cc @@ -651,7 +651,7 @@ RedQueueDisc::Estimator(uint32_t nQueued, uint32_t m, double qAvg, double qW) } // Check if packet p needs to be dropped due to probability mark -uint32_t +bool RedQueueDisc::DropEarly(Ptr item, uint32_t qSize) { NS_LOG_FUNCTION(this << item << qSize); @@ -673,7 +673,7 @@ RedQueueDisc::DropEarly(Ptr item, uint32_t qSize) if ((double)qSize < fraction * m_qAvg) { // Queue could have been empty for 0.05 seconds - return 0; + return false; } } @@ -706,10 +706,10 @@ RedQueueDisc::DropEarly(Ptr item, uint32_t qSize) m_countBytes = 0; /// \todo Implement set bit to mark - return 1; // drop + return true; // drop } - return 0; // no drop/mark + return false; // no drop/mark } // Returns a probability using these function parameters for the DropEarly function diff --git a/src/traffic-control/model/red-queue-disc.h b/src/traffic-control/model/red-queue-disc.h index 1918f895b..f6662bf1e 100644 --- a/src/traffic-control/model/red-queue-disc.h +++ b/src/traffic-control/model/red-queue-disc.h @@ -244,9 +244,9 @@ class RedQueueDisc : public QueueDisc * \brief Check if a packet needs to be dropped due to probability mark * \param item queue item * \param qSize queue size - * \returns 0 for no drop/mark, 1 for drop + * \returns false for no drop/mark, true for drop */ - uint32_t DropEarly(Ptr item, uint32_t qSize); + bool DropEarly(Ptr item, uint32_t qSize); /** * \brief Returns a probability using these function parameters for the DropEarly function * \returns Prob. of packet drop before "count"