Checkpoint. Max bad/good ratio is 1:10. Unknown stats implies 50%. If
anything is in a queue, item will be taken from it (no matter what is
the service count)
diff --git a/model/fw/fw-stats.cc b/model/fw/fw-stats.cc
index 367ba14..3ff136e 100644
--- a/model/fw/fw-stats.cc
+++ b/model/fw/fw-stats.cc
@@ -222,6 +222,25 @@
super::RemoveFace (face);
}
+void
+FwStats::DidReceiveValidNack (Ptr<Face> inFace,
+ uint32_t nackCode,
+ Ptr<pit::Entry> pitEntry)
+{
+ m_stats.Satisfy (pitEntry->GetPrefix ().cut (1));
+ ScheduleRefreshingIfNecessary ();
+
+ // m_stats.UndoNewPitEntry (header->GetName ().cut (1));
+ // m_stats.UndoOutgoing (header->GetName ().cut (1), inFace);
+
+ // for (pit::Enty::in_container::iterator item = pitEntry->GetIncoming ().begin ();
+ // item != pitEntry->GetIncoming ().end ();
+ // item ++)
+ // {
+ // m_stats.UndoIncoming (header->GetName ().cut (1), item->m_face);
+ // }
+}
+
} // namespace fw
} // namespace ndn
diff --git a/model/fw/fw-stats.h b/model/fw/fw-stats.h
index a54642a..6ad7ff0 100644
--- a/model/fw/fw-stats.h
+++ b/model/fw/fw-stats.h
@@ -102,6 +102,11 @@
Ptr<const InterestHeader> header,
Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ DidReceiveValidNack (Ptr<Face> inFace,
+ uint32_t nackCode,
+ Ptr<pit::Entry> pitEntry);
// from Object
void
diff --git a/model/fw/per-fib-limits.cc b/model/fw/per-fib-limits.cc
index ed41eeb..89d4cc4 100644
--- a/model/fw/per-fib-limits.cc
+++ b/model/fw/per-fib-limits.cc
@@ -139,11 +139,11 @@
// const ndnSIM::LoadStatsFace &stats = GetStatsTree ()[header->GetName ()].incoming ().find (inFace)->second;
const ndnSIM::LoadStatsFace &stats = GetStatsTree ()["/"].incoming ().find (inFace)->second;
double weight = std::min (1.0, stats.GetSatisfiedRatio ().get<0> ());
- if (weight < 0)
- {
- // if stats is unknown, gracefully accept interest with normal priority
- weight = 1.0;
- }
+ // if (weight < 0)
+ // {
+ // // if stats is unknown, gracefully accept interest with normal priority
+ // weight = 1.0;
+ // }
bool enqueued = m_pitQueues[outFace].Enqueue (inFace, pitEntry, weight);
@@ -191,7 +191,7 @@
// face->m_face->Send (pkt->Copy ());
// }
// }
-
+
PitQueue::Remove (pitEntry);
for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
@@ -242,7 +242,12 @@
{
// now we have enqueued packet and have slot available. Send out delayed packet
Ptr<pit::Entry> pitEntry = queue->second.Pop ();
- NS_ASSERT_MSG (pitEntry != 0, "There *have to* be an entry in queue");
+ if (pitEntry == 0)
+ {
+ outFace->GetLimits ().RemoveOutstanding ();
+ NS_LOG_DEBUG ("Though there are Interests in queue, weighted round robin decided that packet is not allowed yet");
+ break;
+ }
// hack
// offset lifetime back, so PIT entry wouldn't prematurely expire
@@ -275,12 +280,14 @@
uint32_t nackCode,
Ptr<pit::Entry> pitEntry)
{
+ super::DidReceiveValidNack (inFace, nackCode, pitEntry);
+
// NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
PitQueue::Remove (pitEntry);
Ptr<InterestHeader> nackHeader = Create<InterestHeader> (*pitEntry->GetInterest ());
- nackHeader->SetNack (100);
+ // nackHeader->SetNack (100);
Ptr<Packet> pkt = Create<Packet> ();
pkt->AddHeader (*nackHeader);