Removing support for LeakyBucket per-face limit
diff --git a/helper/ndn-stack-helper.cc b/helper/ndn-stack-helper.cc
index d88eeb2..9fcc8f2 100644
--- a/helper/ndn-stack-helper.cc
+++ b/helper/ndn-stack-helper.cc
@@ -270,9 +270,6 @@
NS_LOG_INFO ("Max packets per second: " << maxInterestPackets);
NS_LOG_INFO ("Max burst: " << m_avgRtt.ToDouble (Time::S) * maxInterestPackets);
- // Set bucket max to BDP
- face->SetBucketMax (m_avgRtt.ToDouble (Time::S) * maxInterestPackets); // number of interests allowed
- face->SetBucketLeak (maxInterestPackets);
}
}
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index f1c92bd..1cbcd09 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -440,11 +440,6 @@
return false; // already forwarded before during this retransmission cycle
}
-
- bool ok = outgoingFace->IsBelowLimit ();
- if (!ok)
- return false;
-
pitEntry->AddOutgoing (outgoingFace);
return true;
}
diff --git a/model/ndn-face.cc b/model/ndn-face.cc
index 936021d..ece32f5 100644
--- a/model/ndn-face.cc
+++ b/model/ndn-face.cc
@@ -90,13 +90,9 @@
*/
Face::Face (Ptr<Node> node)
: m_node (node)
- , m_bucket (0.0)
- , m_bucketMax (-1.0)
- , m_bucketLeak (0.0)
, m_protocolHandler (MakeNullCallback<void,const Ptr<Face>&,const Ptr<const Packet>&> ())
, m_ifup (false)
, m_id ((uint32_t)-1)
- , m_lastLeakTime (0)
, m_metric (0)
// , m_enableMetricTagging (false)
{
@@ -134,55 +130,6 @@
}
bool
-Face::IsBelowLimit ()
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- /// \todo Implement tracing, if requested
-
- if (!IsUp ()){
- NS_LOG_INFO("Face is not up.");
- return false;
- }
-
- LeakBucket ();
-
- if (m_bucketMax > 0)
- {
- NS_LOG_DEBUG ("Limits enabled: " << m_bucketMax << ", current: " << m_bucket);
- if (m_bucket+1.0 > m_bucketMax)
- {
- //NS_LOG_DEBUG ("Returning false");
- return false;
- }
-
- if (m_randomizeLimitChecking)
- {
- static NormalVariable acceptanceProbability (m_bucketMax, m_bucketMax/6.0, m_bucketMax/2.0);
- // static UniformVariable acceptanceProbability (0, m_bucketMax);
- double value = acceptanceProbability.GetValue ();
- if (value > m_bucketMax)
- value -= m_bucketMax;
-
- if (m_bucket < value)
- {
- m_bucket += 1.0;
- return true;
- }
- else
- return false;
- }
- else
- {
- m_bucket += 1.0;
- return true;
- }
- }
-
- return true;
-}
-
-bool
Face::Send (Ptr<Packet> packet)
{
NS_LOG_FUNCTION (boost::cref (*this) << packet << packet->GetSize ());
@@ -243,40 +190,6 @@
}
void
-Face::LeakBucket ()
-{
- if (m_lastLeakTime.IsZero ())
- {
- m_lastLeakTime = Simulator::Now ();
- return;
- }
-
- Time interval = Simulator::Now () - m_lastLeakTime;
- const double leak = m_bucketLeak * interval.ToDouble (Time::S);
- if (leak >= 1.0)
- {
- m_bucket = std::max (0.0, m_bucket - leak);
- m_lastLeakTime = Simulator::Now ();
- }
-
- // NS_LOG_DEBUG ("max: " << m_bucketMax << ", Current bucket: " << m_bucket << ", leak size: " << leak << ", interval: " << interval << ", " << m_bucketLeak);
-}
-
-void
-Face::SetBucketMax (double bucket)
-{
- NS_LOG_FUNCTION (this << bucket);
- m_bucketMax = bucket;
-}
-
-void
-Face::SetBucketLeak (double leak)
-{
- NS_LOG_FUNCTION (this << leak);
- m_bucketLeak = leak;
-}
-
-void
Face::SetMetric (uint16_t metric)
{
NS_LOG_FUNCTION (metric);
diff --git a/model/ndn-face.h b/model/ndn-face.h
index 0a46401..6ed40bc 100644
--- a/model/ndn-face.h
+++ b/model/ndn-face.h
@@ -89,14 +89,7 @@
RegisterProtocolHandler (ProtocolHandler handler);
/**
- * @brief Check if Interest limit is reached
- *
- * Side effect: if limit is not yet reached, the number of outstanding packets will be increased
- *
- * @returns true if Interest limit is not yet reached
*/
- bool
- IsBelowLimit ();
/**
* \brief Send packet on a face
@@ -179,27 +172,6 @@
GetId () const;
/**
- * @brief Set maximum value for Interest allowance
- *
- * @param bucket maximum value for Interest allowance. If < 0, then limit will be disabled
- */
- void
- SetBucketMax (double bucket);
-
- /**
- * @brief Set a normalized value (one second) for Interest allowance bucket leak
- */
- void
- SetBucketLeak (double leak);
-
- /**
- * @brief Leak the Interest allowance bucket by (1/interval) * m_bucketMax amount,
- * where interval is time between two consecutive calls of LeakBucket
- */
- void
- LeakBucket ();
-
- /**
* \brief Compare two faces. Only two faces on the same node could be compared.
*
* Internal index is used for comparison.
@@ -237,20 +209,13 @@
Face& operator= (const Face &); ///< \brief Disabled copy operator
protected:
- // uint16_t m_metric; ///< \brief Routing/forwarding metric
Ptr<Node> m_node; ///< \brief Smart pointer to Node
-
- double m_bucket; ///< \brief Value representing current size of the Interest allowance for this face
- double m_bucketMax; ///< \brief Maximum Interest allowance for this face
- double m_bucketLeak; ///< \brief Normalized amount that should be leaked every second
private:
ProtocolHandler m_protocolHandler; ///< Callback via which packets are getting send to Ndn stack
bool m_ifup; ///< \brief flag indicating that the interface is UP
uint32_t m_id; ///< \brief id of the interface in Ndn stack (per-node uniqueness)
- Time m_lastLeakTime;
uint32_t m_metric; ///< \brief metric of the face
- bool m_randomizeLimitChecking;
// bool m_enableMetricTagging;