ForwardingStrategy removes PIT if interest wasn't propagated. Updated
Limits interface (adding config options). Small randomization for decay
frequency in PerFibLimits strategy.
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
index a148794..2c8c92f 100644
--- a/model/fw/nacks.cc
+++ b/model/fw/nacks.cc
@@ -156,8 +156,6 @@
const Ptr<const Packet> &packet,
Ptr<pit::Entry> pitEntry)
{
- super::DidExhaustForwardingOptions (incomingFace, header, packet, pitEntry);
-
if (m_nacksEnabled)
{
Ptr<Packet> packet = Create<Packet> ();
@@ -171,16 +169,9 @@
m_outNacks (header, incoming.m_face);
}
+ }
- // All incoming interests cannot be satisfied. Remove them
- pitEntry->ClearIncoming ();
-
- // Remove also outgoing
- pitEntry->ClearOutgoing ();
-
- // Set pruning timout on PIT entry (instead of deleting the record)
- m_pit->MarkErased (pitEntry);
- }
+ super::DidExhaustForwardingOptions (incomingFace, header, packet, pitEntry);
}
void
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index cf09878..913448f 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -244,12 +244,24 @@
void
ForwardingStrategy::DidExhaustForwardingOptions (const Ptr<Face> &incomingFace,
- Ptr<InterestHeader> header,
- const Ptr<const Packet> &packet,
- Ptr<pit::Entry> pitEntry)
+ Ptr<InterestHeader> header,
+ const Ptr<const Packet> &packet,
+ Ptr<pit::Entry> pitEntry)
{
NS_LOG_FUNCTION (this << boost::cref (*incomingFace));
- m_dropInterests (header, incomingFace);
+ if (pitEntry->GetOutgoing ().size () == 0)
+ {
+ m_dropInterests (header, incomingFace);
+
+ // All incoming interests cannot be satisfied. Remove them
+ pitEntry->ClearIncoming ();
+
+ // Remove also outgoing
+ pitEntry->ClearOutgoing ();
+
+ // Set pruning timout on PIT entry (instead of deleting the record)
+ m_pit->MarkErased (pitEntry);
+ }
}
void
diff --git a/model/fw/per-fib-limits.cc b/model/fw/per-fib-limits.cc
index 77851bc..ba11f7f 100644
--- a/model/fw/per-fib-limits.cc
+++ b/model/fw/per-fib-limits.cc
@@ -29,6 +29,7 @@
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
+#include "ns3/random-variable.h"
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
@@ -83,13 +84,14 @@
if (pitEntry->GetFibEntry ()->GetLimits ().IsBelowLimit ())
{
- if (outgoingFace->GetLimits ()->IsBelowLimit ())
+ if (outgoingFace->GetLimits ().IsBelowLimit ())
{
pitEntry->AddOutgoing (outgoingFace);
return true;
}
else
{
+ NS_LOG_DEBUG ("Face limit. Reverting back per-prefix allowance");
pitEntry->GetFibEntry ()->GetLimits ().RemoveOutstanding ();
}
}
@@ -106,7 +108,7 @@
face != pitEntry->GetOutgoing ().end ();
face ++)
{
- face->m_face->GetLimits ()->RemoveOutstanding ();
+ face->m_face->GetLimits ().RemoveOutstanding ();
// face->m_face->GetLimits ()->DecreaseLimit (); !!! do not decrease per-face limit. it doesn't make sense !!!
}
@@ -114,7 +116,10 @@
pitEntry->GetFibEntry ()->GetLimits ().DecreaseLimit (); // multiplicative decrease
if (!m_decayLimitsEvent.IsRunning ())
- m_decayLimitsEvent = Simulator::Schedule (Seconds (1.0), &PerFibLimits::DecayLimits, this);
+ {
+ UniformVariable rand (0,5);
+ m_decayLimitsEvent = Simulator::Schedule (Seconds (1.0) + Seconds (0.001 * rand.GetValue ()), &PerFibLimits::DecayLimits, this);
+ }
}
@@ -130,7 +135,7 @@
face != pitEntry->GetOutgoing ().end ();
face ++)
{
- face->m_face->GetLimits ()->RemoveOutstanding ();
+ face->m_face->GetLimits ().RemoveOutstanding ();
// face->m_face->GetLimits ()->IncreaseLimit (); !!! do not increase (as do not decrease) per-face limit. again, it doesn't make sense
}
diff --git a/model/ndn-face.h b/model/ndn-face.h
index d22e073..7741c1e 100644
--- a/model/ndn-face.h
+++ b/model/ndn-face.h
@@ -92,7 +92,7 @@
/**
* @brief Get reference to Limits object
*/
- inline Ptr<Limits>
+ inline Limits&
GetLimits ();
/**
@@ -255,10 +255,10 @@
return !(*this == face);
}
-inline Ptr<Limits>
+inline Limits&
Face::GetLimits ()
{
- return m_limits;
+ return *m_limits;
}