51 bool wantUnused =
false,
52 time::steady_clock::TimePoint now = time::steady_clock::TimePoint::min())
54 shared_ptr<Face> upstream = nexthop.
getFace();
57 if (upstream->getId() == currentDownstream)
61 if (pitEntry->violatesScope(*upstream))
66 pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(*upstream);
67 if (outRecord != pitEntry->getOutRecords().end() &&
68 outRecord->getExpiry() > now) {
85 static inline fib::NextHopList::const_iterator
90 fib::NextHopList::const_iterator found = nexthops.end();
91 time::steady_clock::TimePoint earliestRenewed = time::steady_clock::TimePoint::max();
92 for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {
95 pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(*it->getFace());
96 BOOST_ASSERT(outRecord != pitEntry->getOutRecords().end());
97 if (outRecord->getLastRenewed() < earliestRenewed) {
99 earliestRenewed = outRecord->getLastRenewed();
107 const Interest& interest,
108 shared_ptr<fib::Entry> fibEntry,
109 shared_ptr<pit::Entry> pitEntry)
112 fib::NextHopList::const_iterator it = nexthops.end();
114 bool isNewPitEntry = !pitEntry->hasUnexpiredOutRecords();
117 it = std::find_if(nexthops.begin(), nexthops.end(),
119 false, time::steady_clock::TimePoint::min()));
121 if (it == nexthops.end()) {
127 shared_ptr<Face> outFace = it->getFace();
130 <<
" newPitEntry-to=" << outFace->getId());
136 pit::OutRecordCollection::const_iterator lastOutgoing = std::max_element(
138 BOOST_ASSERT(lastOutgoing != outRecords.end());
140 time::steady_clock::TimePoint now = time::steady_clock::now();
141 time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing->getLastRenewed();
143 if (!shouldRetransmit) {
145 <<
" dontRetransmit sinceLastOutgoing=" << sinceLastOutgoing.count());
150 it = std::find_if(nexthops.begin(), nexthops.end(),
152 if (it != nexthops.end()) {
153 shared_ptr<Face> outFace = it->getFace();
156 <<
" retransmit-unused-to=" << outFace->getId());
162 if (it == nexthops.end()) {
166 shared_ptr<Face> outFace = it->getFace();
169 <<
" retransmit-retry-to=" << outFace->getId());
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) 1
trigger after Interest is received
#define NFD_LOG_DEBUG(expression)
time::steady_clock::TimePoint getLastRenewed() const
static bool compare_OutRecord_lastRenewed(const pit::OutRecord &a, const pit::OutRecord &b)
std::vector< fib::NextHop > NextHopList
void rejectPendingInterest(shared_ptr< pit::Entry > pitEntry)
decide that a pending Interest cannot be forwarded
static const Name STRATEGY_NAME
represents a forwarding strategy
const shared_ptr< Face > & getFace() const
std::list< OutRecord > OutRecordCollection
represents an unordered collection of OutRecords
static bool predicate_NextHop_eligible(const shared_ptr< pit::Entry > &pitEntry, const fib::NextHop &nexthop, FaceId currentDownstream, bool wantUnused=false, time::steady_clock::TimePoint now=time::steady_clock::TimePoint::min())
determines whether a NextHop is eligible
#define NFD_LOG_INIT(name)
contains information about an Interest toward an outgoing face
void sendInterest(shared_ptr< pit::Entry > pitEntry, shared_ptr< Face > outFace, bool wantNewNonce=false)
send Interest to outFace
BestRouteStrategy2(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
static const time::milliseconds MIN_RETRANSMISSION_INTERVAL
static fib::NextHopList::const_iterator findEligibleNextHopWithEarliestOutRecord(const shared_ptr< pit::Entry > &pitEntry, const fib::NextHopList &nexthops, FaceId currentDownstream)
pick an eligible NextHop with earliest OutRecord
represents a nexthop record in FIB entry