table: don't use shared_ptr in FIB
refs #3164
Change-Id: I5b5eb47d60f6bf5b6389c32ac840f793767e4334
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index a3b2aba..ac5c3ef 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -75,10 +75,10 @@
BOOST_AUTO_TEST_CASE(Forward)
{
- shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
- fibEntry->addNextHop(face1, 10);
- fibEntry->addNextHop(face2, 20);
- fibEntry->addNextHop(face3, 30);
+ fib::Entry& fibEntry = *fib.insert(Name()).first;
+ fibEntry.addNextHop(*face1, 10);
+ fibEntry.addNextHop(*face2, 20);
+ fibEntry.addNextHop(*face3, 30);
shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA");
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
@@ -127,7 +127,7 @@
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[4].outFaceId, face1->getId());
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[5].outFaceId, face3->getId());
- fibEntry->removeNextHop(face1);
+ fibEntry.removeNextHop(*face1);
strategy.sendInterestHistory.clear();
for (int i = 0; i < 3; ++i) {
@@ -153,10 +153,10 @@
return "/P";
}
- shared_ptr<fib::Entry>
- makeFibEntry(BestRouteStrategy2Fixture* fixture)
+ void
+ insertFibEntry(BestRouteStrategy2Fixture* fixture)
{
- return fixture->fib.insert(Name()).first;
+ fixture->fib.insert(Name());
}
};
@@ -169,12 +169,10 @@
return "/P";
}
- shared_ptr<fib::Entry>
- makeFibEntry(BestRouteStrategy2Fixture* fixture)
+ void
+ insertFibEntry(BestRouteStrategy2Fixture* fixture)
{
- shared_ptr<fib::Entry> fibEntry = fixture->fib.insert(Name()).first;
- fibEntry->addNextHop(fixture->face1, 10);
- return fibEntry;
+ fixture->fib.insert(Name()).first->addNextHop(*fixture->face1, 10);
}
};
@@ -187,13 +185,11 @@
return "/localhop/P";
}
- shared_ptr<fib::Entry>
- makeFibEntry(BestRouteStrategy2Fixture* fixture)
+ void
+ insertFibEntry(BestRouteStrategy2Fixture* fixture)
{
- shared_ptr<fib::Entry> fibEntry = fixture->fib.insert("/localhop").first;
- fibEntry->addNextHop(fixture->face2, 10);
+ fixture->fib.insert("/localhop").first->addNextHop(*fixture->face2, 10);
// face1 and face2 are both non-local; Interest from face1 cannot be forwarded to face2
- return fibEntry;
}
};
@@ -202,13 +198,12 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(IncomingInterest, Scenario, NoRouteScenarios)
{
Scenario scenario;
+ scenario.insertFibEntry(this);
shared_ptr<Interest> interest = makeInterest(scenario.getInterestName());
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(face1, *interest);
- shared_ptr<fib::Entry> fibEntry = scenario.makeFibEntry(this);
-
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
@@ -226,10 +221,10 @@
BOOST_AUTO_TEST_CASE(OneUpstream) // one upstream, send Nack when Nack arrives
{
- shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
- fibEntry->addNextHop(face3, 10);
- fibEntry->addNextHop(face4, 20);
- fibEntry->addNextHop(face5, 30);
+ fib::Entry& fibEntry = *fib.insert(Name()).first;
+ fibEntry.addNextHop(*face3, 10);
+ fibEntry.addNextHop(*face4, 20);
+ fibEntry.addNextHop(*face5, 30);
shared_ptr<Interest> interest1 = makeInterest("/McQYjMbm", 992);
shared_ptr<Interest> interest2 = makeInterest("/McQYjMbm", 114);
@@ -256,10 +251,10 @@
BOOST_AUTO_TEST_CASE(TwoUpstreams) // two upstreams, send Nack when both Nacks arrive
{
- shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
- fibEntry->addNextHop(face3, 10);
- fibEntry->addNextHop(face4, 20);
- fibEntry->addNextHop(face5, 30);
+ fib::Entry& fibEntry = *fib.insert(Name()).first;
+ fibEntry.addNextHop(*face3, 10);
+ fibEntry.addNextHop(*face4, 20);
+ fibEntry.addNextHop(*face5, 30);
shared_ptr<Interest> interest1 = makeInterest("/aS9FAyUV19", 286);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
@@ -285,10 +280,10 @@
BOOST_AUTO_TEST_CASE(Timeout) // two upstreams, one times out, don't send Nack
{
- shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
- fibEntry->addNextHop(face3, 10);
- fibEntry->addNextHop(face4, 20);
- fibEntry->addNextHop(face5, 30);
+ fib::Entry& fibEntry = *fib.insert(Name()).first;
+ fibEntry.addNextHop(*face3, 10);
+ fibEntry.addNextHop(*face4, 20);
+ fibEntry.addNextHop(*face5, 30);
shared_ptr<Interest> interest1 = makeInterest("/sIYw0TXWDj", 115);
interest1->setInterestLifetime(time::milliseconds(400));
@@ -429,10 +424,10 @@
{
Combination combination;
- shared_ptr<fib::Entry> fibEntry = fib.insert(Name()).first;
- fibEntry->addNextHop(face3, 10);
- fibEntry->addNextHop(face4, 20);
- fibEntry->addNextHop(face5, 30);
+ fib::Entry& fibEntry = *fib.insert(Name()).first;
+ fibEntry.addNextHop(*face3, 10);
+ fibEntry.addNextHop(*face4, 20);
+ fibEntry.addNextHop(*face5, 30);
shared_ptr<Interest> interest1 = makeInterest("/F6sEwB24I", 282);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;