fw: eliminate fibEntry in Strategy API
Strategy::lookupFib can be used to obtain FIB entry.
FIB lookup is skipped when strategy does not need it.
refs #3205
Change-Id: Icba67229cbc261d9def44ffa91461ea4b09982b2
diff --git a/daemon/fw/asf-probing-module.cpp b/daemon/fw/asf-probing-module.cpp
index 4be41f0..f561b52 100644
--- a/daemon/fw/asf-probing-module.cpp
+++ b/daemon/fw/asf-probing-module.cpp
@@ -45,9 +45,9 @@
}
void
-ProbingModule::scheduleProbe(shared_ptr<fib::Entry> fibEntry, const time::milliseconds& interval)
+ProbingModule::scheduleProbe(const fib::Entry& fibEntry, const time::milliseconds& interval)
{
- ndn::Name prefix = fibEntry->getPrefix();
+ ndn::Name prefix = fibEntry.getPrefix();
// Set the probing flag for the namespace to true after passed interval of time
scheduler::schedule(interval, [this, prefix] {
@@ -67,7 +67,7 @@
shared_ptr<Face>
ProbingModule::getFaceToProbe(const Face& inFace,
const Interest& interest,
- shared_ptr<fib::Entry> fibEntry,
+ const fib::Entry& fibEntry,
const Face& faceUsed)
{
FaceInfoFacePairSet rankedFaces(
@@ -83,7 +83,7 @@
// Put eligible faces into rankedFaces. If a face does not have an RTT measurement,
// immediately pick the face for probing
- for (const fib::NextHop& hop : fibEntry->getNextHops()) {
+ for (const fib::NextHop& hop : fibEntry.getNextHops()) {
const shared_ptr<Face>& hopFace = hop.getFace();
// Don't send probe Interest back to the incoming face or use the same face
@@ -92,7 +92,7 @@
continue;
}
- FaceInfo* info = m_measurements.getFaceInfo(*fibEntry, interest, *hopFace);
+ FaceInfo* info = m_measurements.getFaceInfo(fibEntry, interest, *hopFace);
// If no RTT has been recorded, probe this face
if (info == nullptr || !info->hasSrttMeasurement()) {
@@ -112,10 +112,10 @@
}
bool
-ProbingModule::isProbingNeeded(shared_ptr<fib::Entry> fibEntry, const ndn::Interest& interest)
+ProbingModule::isProbingNeeded(const fib::Entry& fibEntry, const ndn::Interest& interest)
{
// Return the probing status flag for a namespace
- NamespaceInfo& info = m_measurements.getOrCreateNamespaceInfo(*fibEntry, interest);
+ NamespaceInfo& info = m_measurements.getOrCreateNamespaceInfo(fibEntry, interest);
// If a first probe has not been scheduled for a namespace
if (!info.isFirstProbeScheduled()) {
@@ -130,11 +130,11 @@
}
void
-ProbingModule::afterForwardingProbe(shared_ptr<fib::Entry> fibEntry, const ndn::Interest& interest)
+ProbingModule::afterForwardingProbe(const fib::Entry& fibEntry, const ndn::Interest& interest)
{
// After probing is done, need to set probing flag to false and
// schedule another future probe
- NamespaceInfo& info = m_measurements.getOrCreateNamespaceInfo(*fibEntry, interest);
+ NamespaceInfo& info = m_measurements.getOrCreateNamespaceInfo(fibEntry, interest);
info.setIsProbingDue(false);
scheduleProbe(fibEntry, m_probingInterval);