fw: handle dropped packets in strategies
refs #5128
Change-Id: Ic7f7e61b2dde66004d0291bb41e008961fc7b252
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index ea32709..59a3f8f 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -149,13 +149,17 @@
{
for (auto& outFace : this->getFaceTable() | boost::adaptors::reversed) {
if ((outFace.getId() == inFace.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
- wouldViolateScope(inFace, interest, outFace) || outFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
+ wouldViolateScope(inFace, interest, outFace) ||
+ outFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
continue;
}
- this->sendInterest(pitEntry, outFace, interest);
- pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
- NFD_LOG_DEBUG("send discovery Interest=" << interest << " from="
- << inFace.getId() << " to=" << outFace.getId());
+
+ NFD_LOG_DEBUG("send discovery Interest=" << interest << " from=" << inFace.getId() <<
+ " to=" << outFace.getId());
+ auto outRecord = this->sendInterest(pitEntry, outFace, interest);
+ if (outRecord != nullptr) {
+ outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
+ }
}
}
@@ -165,15 +169,17 @@
const fib::NextHopList& nexthops)
{
for (const auto& nexthop : nexthops) {
- Face& outFace = nexthop.getFace();
- if ((outFace.getId() == inFace.getId() && outFace.getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) ||
- wouldViolateScope(inFace, interest, outFace)) {
+ if (!isNextHopEligible(inFace, interest, nexthop, pitEntry)) {
continue;
}
- this->sendInterest(pitEntry, outFace, interest);
- pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
- NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from="
- << inFace.getId() << " to=" << outFace.getId());
+
+ Face& outFace = nexthop.getFace();
+ NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from=" << inFace.getId() <<
+ " to=" << outFace.getId());
+ auto outRecord = this->sendInterest(pitEntry, outFace, interest);
+ if (outRecord != nullptr) {
+ outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
+ }
}
}