Correction of the leak
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index e6aa03f..51b3ba4 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -91,6 +91,15 @@
return true;
}
+void
+CcnxFace::LeakBucket (const Time &interval)
+{
+ const double leak = m_bucketLeak * interval.ToDouble (Time::S);
+ m_bucket -= std::max (0.0, m_bucket - leak);
+
+ NS_LOG_ERROR ("max: " << m_bucketMax << ", Current bucket: " << m_bucket << ", leak size: " << leak << ", interval: " << interval << ", " << m_bucketLeak);
+}
+
bool
CcnxFace::Send (Ptr<Packet> packet)
{
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 94b48ab..40de808 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -179,7 +179,7 @@
*
* @param interval Time interval with which the bucket is leaked
*/
- inline void
+ void
LeakBucket (const Time &interval);
inline void
@@ -261,13 +261,6 @@
}
void
-CcnxFace::LeakBucket (const Time &interval)
-{
- const double leak = m_bucketLeak * 1.0 / interval.ToDouble (Time::S);
- m_bucket -= std::max (0.0, m_bucket-leak);
-}
-
-void
CcnxFace::LeakBucketByOnePacket ()
{
m_bucket -= std::max (0.0, m_bucket-1.0);
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 718e684..187a020 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -583,13 +583,15 @@
void
CcnxL3Protocol::LeakBuckets ()
{
+ NS_LOG_FUNCTION (this);
BOOST_FOREACH (const Ptr<CcnxFace> &face, m_faces)
{
face->LeakBucket (m_bucketLeakInterval);
}
m_bucketLeakEvent = Simulator::Schedule (m_bucketLeakInterval,
- &CcnxL3Protocol::LeakBuckets, this);
+ &CcnxL3Protocol::LeakBuckets,
+ this);
}
} //namespace ns3