model.fw: Correcting a "slightly" broken NACKs, though still not sure if everything works as it should.
diff --git a/model/fw/green-yellow-red.cc b/model/fw/green-yellow-red.cc
index 6611c13..3351cda 100644
--- a/model/fw/green-yellow-red.cc
+++ b/model/fw/green-yellow-red.cc
@@ -107,12 +107,15 @@
void
GreenYellowRed::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
+ Ptr<const InterestHeader> header,
+ Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry)
{
- super::DidReceiveValidNack (inFace, nackCode, pitEntry);
+ super::DidReceiveValidNack (inFace, nackCode, header, origPacket, pitEntry);
if (inFace != 0 &&
- nackCode != InterestHeader::NACK_LOOP)
+ (nackCode == InterestHeader::NACK_CONGESTION ||
+ nackCode == InterestHeader::NACK_GIVEUP_PIT))
{
pitEntry->GetFibEntry ()->UpdateStatus (inFace, fib::FaceMetric::NDN_FIB_YELLOW);
}
diff --git a/model/fw/green-yellow-red.h b/model/fw/green-yellow-red.h
index 4099a12..363d0cb 100644
--- a/model/fw/green-yellow-red.h
+++ b/model/fw/green-yellow-red.h
@@ -49,6 +49,8 @@
virtual void
DidReceiveValidNack (Ptr<Face> incomingFace,
uint32_t nackCode,
+ Ptr<const InterestHeader> header,
+ Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry);
private:
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
index 4a4245c..511b022 100644
--- a/model/fw/nacks.cc
+++ b/model/fw/nacks.cc
@@ -104,29 +104,7 @@
//
// inFace->LeakBucketByOnePacket ();
- // pitEntry->SetWaitingInVain (inFace);
-
- DidReceiveValidNack (inFace, header->GetNack (), pitEntry);
-
- // if (!pitEntry->AreAllOutgoingInVain ()) // not all ougtoing are in vain
- // {
- // NS_LOG_DEBUG ("Not all outgoing are in vain");
- // // suppress
- // // Don't do anything, we are still expecting data from some other face
- // m_dropNacks (header, inFace);
- // return;
- // }
-
- // Ptr<Packet> nonNackInterest = Create<Packet> ();
- // Ptr<InterestHeader> nonNackHeader = Create<InterestHeader> (*header);
- // nonNackHeader->SetNack (InterestHeader::NORMAL_INTEREST);
- // nonNackInterest->AddHeader (*nonNackHeader);
-
- // bool propagated = DoPropagateInterest (inFace, nonNackHeader, nonNackInterest, pitEntry);
- // if (!propagated)
- // {
- // DidExhaustForwardingOptions (inFace, nonNackHeader, nonNackInterest, pitEntry);
- // }
+ DidReceiveValidNack (inFace, header->GetNack (), header, origPacket, pitEntry);
}
void
@@ -178,6 +156,8 @@
void
Nacks::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
+ Ptr<const InterestHeader> header,
+ Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry)
{
// If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
@@ -187,7 +167,32 @@
pitEntry->RemoveIncoming (inFace);
}
- pitEntry->GetFibEntry ()->UpdateStatus (inFace, fib::FaceMetric::NDN_FIB_YELLOW);
+ if (nackCode == InterestHeader::NACK_LOOP ||
+ nackCode == InterestHeader::NACK_CONGESTION ||
+ nackCode == InterestHeader::NACK_GIVEUP_PIT)
+ {
+ pitEntry->SetWaitingInVain (inFace);
+
+ if (!pitEntry->AreAllOutgoingInVain ()) // not all ougtoing are in vain
+ {
+ NS_LOG_DEBUG ("Not all outgoing are in vain");
+ // suppress
+ // Don't do anything, we are still expecting data from some other face
+ m_dropNacks (header, inFace);
+ return;
+ }
+
+ Ptr<Packet> nonNackInterest = Create<Packet> ();
+ Ptr<InterestHeader> nonNackHeader = Create<InterestHeader> (*header);
+ nonNackHeader->SetNack (InterestHeader::NORMAL_INTEREST);
+ nonNackInterest->AddHeader (*nonNackHeader);
+
+ bool propagated = DoPropagateInterest (inFace, nonNackHeader, nonNackInterest, pitEntry);
+ if (!propagated)
+ {
+ DidExhaustForwardingOptions (inFace, nonNackHeader, nonNackInterest, pitEntry);
+ }
+ }
}
} // namespace fw
diff --git a/model/fw/nacks.h b/model/fw/nacks.h
index f247f25..ef14f19 100644
--- a/model/fw/nacks.h
+++ b/model/fw/nacks.h
@@ -69,6 +69,8 @@
virtual void
DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
+ Ptr<const InterestHeader> header,
+ Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry);
protected:
diff --git a/model/fw/simple-limits.h b/model/fw/simple-limits.h
index ee88c21..22a94ed 100644
--- a/model/fw/simple-limits.h
+++ b/model/fw/simple-limits.h
@@ -25,6 +25,7 @@
#include "ns3/event-id.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
+#include "ns3/simulator.h"
#include "ns3/ndn-forwarding-strategy.h"
@@ -103,8 +104,6 @@
return false;
}
- // NS_LOG_DEBUG ("Limit: " << outFace->GetLimits ().m_curMaxLimit << ", outstanding: " << outFace->GetLimits ().m_outstanding);
-
if (outFace->GetLimits ().IsBelowLimit ())
{
pitEntry->AddOutgoing (outFace);