table: pit::FaceRecord stores Face& instead of shared_ptr
refs #3164
Change-Id: Ib23ab2341a37213fee791f2070f13b76da851d53
diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp
index df6ca4d..5080d9c 100644
--- a/daemon/fw/best-route-strategy2.cpp
+++ b/daemon/fw/best-route-strategy2.cpp
@@ -195,7 +195,7 @@
const lp::NackHeader* inNack = outR.getIncomingNack();
if (inNack == nullptr) {
++nOutRecordsNotNacked;
- lastFaceNotNacked = outR.getFace().get();
+ lastFaceNotNacked = &outR.getFace();
continue;
}
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 2fbc93c..ff8e451 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -196,9 +196,8 @@
{
NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName());
- shared_ptr<Face> face = const_pointer_cast<Face>(inFace.shared_from_this());
// insert in-record
- pitEntry->insertOrUpdateInRecord(face, interest);
+ pitEntry->insertOrUpdateInRecord(const_cast<Face&>(inFace), interest);
// set PIT unsatisfy timer
this->setUnsatisfyTimer(pitEntry);
@@ -252,8 +251,8 @@
pit::InRecordCollection::iterator pickedInRecord = std::max_element(
pitEntry->in_begin(), pitEntry->in_end(),
[&outFace] (const pit::InRecord& a, const pit::InRecord& b) {
- bool isOutFaceA = a.getFace().get() == &outFace;
- bool isOutFaceB = b.getFace().get() == &outFace;
+ bool isOutFaceA = &a.getFace() == &outFace;
+ bool isOutFaceB = &b.getFace() == &outFace;
return (isOutFaceA > isOutFaceB) ||
(isOutFaceA == isOutFaceB && a.getLastRenewed() < b.getLastRenewed());
});
@@ -267,7 +266,7 @@
}
// insert out-record
- pitEntry->insertOrUpdateOutRecord(outFace.shared_from_this(), *interest);
+ pitEntry->insertOrUpdateOutRecord(outFace, *interest);
// send Interest
outFace.sendInterest(*interest);
@@ -360,7 +359,7 @@
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
- pendingDownstreams.insert(inRecord.getFace().get());
+ pendingDownstreams.insert(&inRecord.getFace());
}
}
diff --git a/daemon/fw/pit-algorithm.cpp b/daemon/fw/pit-algorithm.cpp
index a9ef7ea..3ff63b8 100644
--- a/daemon/fw/pit-algorithm.cpp
+++ b/daemon/fw/pit-algorithm.cpp
@@ -49,7 +49,7 @@
if (scope_prefix::LOCALHOP.isPrefixOf(pitEntry.getName())) {
// face is non-local, violates localhop scope unless PIT entry has local in-record
return std::none_of(pitEntry.in_begin(), pitEntry.in_end(),
- [] (const pit::InRecord& inRecord) { return inRecord.getFace()->getScope() == ndn::nfd::FACE_SCOPE_LOCAL; });
+ [] (const pit::InRecord& inRecord) { return inRecord.getFace().getScope() == ndn::nfd::FACE_SCOPE_LOCAL; });
}
// Name is not subject to scope control
@@ -63,7 +63,7 @@
bool hasUnexpiredOutRecord = std::any_of(pitEntry.out_begin(), pitEntry.out_end(),
[&face, &now] (const pit::OutRecord& outRecord) {
- return outRecord.getFace().get() == &face && outRecord.getExpiry() >= now;
+ return &outRecord.getFace() == &face && outRecord.getExpiry() >= now;
});
if (hasUnexpiredOutRecord) {
return false;
@@ -71,7 +71,7 @@
bool hasUnexpiredOtherInRecord = std::any_of(pitEntry.in_begin(), pitEntry.in_end(),
[&face, &now] (const pit::InRecord& inRecord) {
- return inRecord.getFace().get() != &face && inRecord.getExpiry() >= now;
+ return &inRecord.getFace() != &face && inRecord.getExpiry() >= now;
});
if (!hasUnexpiredOtherInRecord) {
return false;
@@ -87,7 +87,7 @@
for (const pit::InRecord& inRecord : pitEntry.getInRecords()) {
if (inRecord.getLastNonce() == nonce) {
- if (inRecord.getFace().get() == &face) {
+ if (&inRecord.getFace() == &face) {
dnw |= DUPLICATE_NONCE_IN_SAME;
}
else {
@@ -98,7 +98,7 @@
for (const pit::OutRecord& outRecord : pitEntry.getOutRecords()) {
if (outRecord.getLastNonce() == nonce) {
- if (outRecord.getFace().get() == &face) {
+ if (&outRecord.getFace() == &face) {
dnw |= DUPLICATE_NONCE_OUT_SAME;
}
else {
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 2a40517..f645369 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -75,10 +75,10 @@
// populate downstreams with all downstreams faces
std::unordered_set<const Face*> downstreams;
std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
- [] (const pit::InRecord& inR) { return inR.getFace().get(); });
+ [] (const pit::InRecord& inR) { return &inR.getFace(); });
// delete excluded faces
- // .erase in a loop is more efficient than std::set_difference between that requires sorted range
+ // .erase in a loop is more efficient than std::set_difference because that requires sorted range
for (const Face* exceptFace : exceptFaces) {
downstreams.erase(exceptFace);
}
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index d19369a..395fc90 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -38,14 +38,14 @@
Entry::getInRecord(const Face& face)
{
return std::find_if(m_inRecords.begin(), m_inRecords.end(),
- [&face] (const InRecord& inRecord) { return inRecord.getFace().get() == &face; });
+ [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
}
InRecordCollection::iterator
-Entry::insertOrUpdateInRecord(shared_ptr<Face> face, const Interest& interest)
+Entry::insertOrUpdateInRecord(Face& face, const Interest& interest)
{
auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
- [&face] (const InRecord& inRecord) { return inRecord.getFace() == face; });
+ [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
if (it == m_inRecords.end()) {
m_inRecords.emplace_front(face);
it = m_inRecords.begin();
@@ -59,7 +59,7 @@
Entry::deleteInRecord(const Face& face)
{
auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
- [&face] (const InRecord& inRecord) { return inRecord.getFace().get() == &face; });
+ [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
if (it != m_inRecords.end()) {
m_inRecords.erase(it);
}
@@ -75,14 +75,14 @@
Entry::getOutRecord(const Face& face)
{
return std::find_if(m_outRecords.begin(), m_outRecords.end(),
- [&face] (const OutRecord& outRecord) { return outRecord.getFace().get() == &face; });
+ [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
}
OutRecordCollection::iterator
-Entry::insertOrUpdateOutRecord(shared_ptr<Face> face, const Interest& interest)
+Entry::insertOrUpdateOutRecord(Face& face, const Interest& interest)
{
auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
- [&face] (const OutRecord& outRecord) { return outRecord.getFace() == face; });
+ [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
if (it == m_outRecords.end()) {
m_outRecords.emplace_front(face);
it = m_outRecords.begin();
@@ -96,7 +96,7 @@
Entry::deleteOutRecord(const Face& face)
{
auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
- [&face] (const OutRecord& outRecord) { return outRecord.getFace().get() == &face; });
+ [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
if (it != m_outRecords.end()) {
m_outRecords.erase(it);
}
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index 5f77a4d..99832ad 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -111,7 +111,7 @@
* \return an iterator to the new or updated in-record
*/
InRecordCollection::iterator
- insertOrUpdateInRecord(shared_ptr<Face> face, const Interest& interest);
+ insertOrUpdateInRecord(Face& face, const Interest& interest);
/** \brief delete the in-record for \p face if it exists
*/
@@ -160,7 +160,7 @@
* \return an iterator to the new or updated out-record
*/
OutRecordCollection::iterator
- insertOrUpdateOutRecord(shared_ptr<Face> face, const Interest& interest);
+ insertOrUpdateOutRecord(Face& face, const Interest& interest);
/** \brief delete the out-record for \p face if it exists
*/
diff --git a/daemon/table/pit-face-record.cpp b/daemon/table/pit-face-record.cpp
index c62a1b5..d594cb9 100644
--- a/daemon/table/pit-face-record.cpp
+++ b/daemon/table/pit-face-record.cpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
+ * Copyright (c) 2014-2016, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -28,7 +28,7 @@
namespace nfd {
namespace pit {
-FaceRecord::FaceRecord(shared_ptr<Face> face)
+FaceRecord::FaceRecord(Face& face)
: m_face(face)
, m_lastNonce(0)
, m_lastRenewed(time::steady_clock::TimePoint::min())
diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp
index c1d6c77..90c3cdb 100644
--- a/daemon/table/pit-face-record.hpp
+++ b/daemon/table/pit-face-record.hpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
+ * Copyright (c) 2014-2016, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -41,9 +41,9 @@
{
public:
explicit
- FaceRecord(shared_ptr<Face> face);
+ FaceRecord(Face& face);
- shared_ptr<Face>
+ Face&
getFace() const;
uint32_t
@@ -64,13 +64,13 @@
update(const Interest& interest);
private:
- shared_ptr<Face> m_face;
+ Face& m_face;
uint32_t m_lastNonce;
time::steady_clock::TimePoint m_lastRenewed;
time::steady_clock::TimePoint m_expiry;
};
-inline shared_ptr<Face>
+inline Face&
FaceRecord::getFace() const
{
return m_face;
diff --git a/daemon/table/pit-in-record.cpp b/daemon/table/pit-in-record.cpp
index b7f0edf..8167190 100644
--- a/daemon/table/pit-in-record.cpp
+++ b/daemon/table/pit-in-record.cpp
@@ -1,11 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014 Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology
+ * Copyright (c) 2014-2016, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,14 +21,14 @@
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "pit-in-record.hpp"
namespace nfd {
namespace pit {
-InRecord::InRecord(shared_ptr<Face> face)
+InRecord::InRecord(Face& face)
: FaceRecord(face)
{
}
diff --git a/daemon/table/pit-in-record.hpp b/daemon/table/pit-in-record.hpp
index dd6ad06..45167c3 100644
--- a/daemon/table/pit-in-record.hpp
+++ b/daemon/table/pit-in-record.hpp
@@ -37,7 +37,7 @@
{
public:
explicit
- InRecord(shared_ptr<Face> face);
+ InRecord(Face& face);
void
update(const Interest& interest);
diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp
index 1cf303d..8b4f609 100644
--- a/daemon/table/pit-out-record.cpp
+++ b/daemon/table/pit-out-record.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,7 @@
namespace nfd {
namespace pit {
-OutRecord::OutRecord(shared_ptr<Face> face)
+OutRecord::OutRecord(Face& face)
: FaceRecord(face)
{
}
diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp
index 4717779..4400fd4 100644
--- a/daemon/table/pit-out-record.hpp
+++ b/daemon/table/pit-out-record.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,7 +37,7 @@
{
public:
explicit
- OutRecord(shared_ptr<Face> face);
+ OutRecord(Face& face);
/** \return last NACK returned by \p getFace()
*
diff --git a/tests/daemon/fw/asf-measurements.t.cpp b/tests/daemon/fw/asf-measurements.t.cpp
index 2b83004..ffee3e6 100644
--- a/tests/daemon/fw/asf-measurements.t.cpp
+++ b/tests/daemon/fw/asf-measurements.t.cpp
@@ -100,7 +100,7 @@
shared_ptr<pit::Entry> pitEntry = make_shared<pit::Entry>(*interest);
std::shared_ptr<DummyFace> face = make_shared<DummyFace>();
- pitEntry->insertOrUpdateOutRecord(face, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face, *interest);
RttEstimator::Duration rtt(50);
this->advanceClocks(time::milliseconds(5), rtt);
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index ac5c3ef..3a0ed29 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -88,7 +88,7 @@
// first Interest goes to nexthop with lowest FIB cost,
// however face1 is downstream so it cannot be used
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
@@ -100,7 +100,7 @@
time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
- pitEntry->insertOrUpdateInRecord(face4, *interest);
+ pitEntry->insertOrUpdateInRecord(*face4, *interest);
strategy.afterReceiveInterest(*face4, *interest, pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
@@ -132,7 +132,7 @@
strategy.sendInterestHistory.clear();
for (int i = 0; i < 3; ++i) {
this->advanceClocks(TICK, BestRouteStrategy2::RETX_SUPPRESSION_MAX * 2);
- pitEntry->insertOrUpdateInRecord(face5, *interest);
+ pitEntry->insertOrUpdateInRecord(*face5, *interest);
strategy.afterReceiveInterest(*face5, *interest, pitEntry);
}
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
@@ -202,7 +202,7 @@
shared_ptr<Interest> interest = makeInterest(scenario.getInterestName());
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
@@ -229,9 +229,9 @@
shared_ptr<Interest> interest1 = makeInterest("/McQYjMbm", 992);
shared_ptr<Interest> interest2 = makeInterest("/McQYjMbm", 114);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest1);
- pitEntry->insertOrUpdateInRecord(face2, *interest2);
- pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest1);
+ pitEntry->insertOrUpdateInRecord(*face2, *interest2);
+ pitEntry->insertOrUpdateOutRecord(*face3, *interest1);
lp::Nack nack3 = makeNack("/McQYjMbm", 992, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
@@ -258,9 +258,9 @@
shared_ptr<Interest> interest1 = makeInterest("/aS9FAyUV19", 286);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest1);
- pitEntry->insertOrUpdateOutRecord(face3, *interest1);
- pitEntry->insertOrUpdateOutRecord(face4, *interest1);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest1);
+ pitEntry->insertOrUpdateOutRecord(*face3, *interest1);
+ pitEntry->insertOrUpdateOutRecord(*face4, *interest1);
lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
@@ -288,13 +288,13 @@
shared_ptr<Interest> interest1 = makeInterest("/sIYw0TXWDj", 115);
interest1->setInterestLifetime(time::milliseconds(400));
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest1);
- pitEntry->insertOrUpdateOutRecord(face3, *interest1);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest1);
+ pitEntry->insertOrUpdateOutRecord(*face3, *interest1);
this->advanceClocks(time::milliseconds(300));
shared_ptr<Interest> interest2 = makeInterest("/sIYw0TXWDj", 223);
- pitEntry->insertOrUpdateInRecord(face1, *interest2);
- pitEntry->insertOrUpdateOutRecord(face4, *interest2);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest2);
+ pitEntry->insertOrUpdateOutRecord(*face4, *interest2);
this->advanceClocks(time::milliseconds(200)); // face3 has timed out
@@ -431,9 +431,9 @@
shared_ptr<Interest> interest1 = makeInterest("/F6sEwB24I", 282);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest1);
- pitEntry->insertOrUpdateOutRecord(face3, *interest1);
- pitEntry->insertOrUpdateOutRecord(face4, *interest1);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest1);
+ pitEntry->insertOrUpdateOutRecord(*face3, *interest1);
+ pitEntry->insertOrUpdateOutRecord(*face4, *interest1);
lp::Nack nack3 = makeNack("/F6sEwB24I", 282, combination.getX());
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
diff --git a/tests/daemon/fw/client-control-strategy.t.cpp b/tests/daemon/fw/client-control-strategy.t.cpp
index 0a31244..9f500e8 100644
--- a/tests/daemon/fw/client-control-strategy.t.cpp
+++ b/tests/daemon/fw/client-control-strategy.t.cpp
@@ -63,7 +63,7 @@
shared_ptr<Interest> interest1 = makeInterest("ndn:/0z8r6yDDe");
interest1->setTag(make_shared<lp::NextHopFaceIdTag>(face1->getId()));
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
- pitEntry1->insertOrUpdateInRecord(face4, *interest1);
+ pitEntry1->insertOrUpdateInRecord(*face4, *interest1);
strategy.sendInterestHistory.clear();
strategy.afterReceiveInterest(*face4, *interest1, pitEntry1);
@@ -73,7 +73,7 @@
// Interest without NextHopFaceId
shared_ptr<Interest> interest2 = makeInterest("ndn:/y6JQADGVz");
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
- pitEntry2->insertOrUpdateInRecord(face4, *interest2);
+ pitEntry2->insertOrUpdateInRecord(*face4, *interest2);
strategy.sendInterestHistory.clear();
strategy.afterReceiveInterest(*face4, *interest2, pitEntry2);
@@ -84,7 +84,7 @@
shared_ptr<Interest> interest3 = makeInterest("ndn:/0z8r6yDDe");
interest3->setTag(make_shared<lp::NextHopFaceIdTag>(face3->getId()));
shared_ptr<pit::Entry> pitEntry3 = pit.insert(*interest3).first;
- pitEntry3->insertOrUpdateInRecord(face4, *interest3);
+ pitEntry3->insertOrUpdateInRecord(*face4, *interest3);
face3->close(); // face3 is closed and its FaceId becomes invalid
strategy.sendInterestHistory.clear();
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index ad2877e..0e6741c 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -129,7 +129,7 @@
auto interestA1 = makeInterest("/A");
interestA1->setNonce(8378);
shared_ptr<pit::Entry> pitA = pit.insert(*interestA1).first;
- pit::InRecordCollection::iterator inA1 = pitA->insertOrUpdateInRecord(face1, *interestA1);
+ pit::InRecordCollection::iterator inA1 = pitA->insertOrUpdateInRecord(*face1, *interestA1);
// there is only one downstream, interestA1 is used
forwarder.onOutgoingInterest(pitA, *face3, false);
@@ -151,7 +151,7 @@
this->advanceClocks(time::seconds(2));
auto interestA2 = makeInterest("/A");
interestA2->setNonce(9102);
- pitA->insertOrUpdateInRecord(face2, *interestA2);
+ pitA->insertOrUpdateInRecord(*face2, *interestA2);
// there are two downstreams, prefer newer interestA2
forwarder.onOutgoingInterest(pitA, *face3, false);
@@ -265,7 +265,7 @@
// local face, /localhost: OK
shared_ptr<Interest> interestA1 = makeInterest("/localhost/A1");
shared_ptr<pit::Entry> pitA1 = pit.insert(*interestA1).first;
- pitA1->insertOrUpdateInRecord(face3, *interestA1);
+ pitA1->insertOrUpdateInRecord(*face3, *interestA1);
face1->sentInterests.clear();
forwarder.onOutgoingInterest(pitA1, *face1);
BOOST_CHECK_EQUAL(face1->sentInterests.size(), 1);
@@ -273,7 +273,7 @@
// non-local face, /localhost: violate
shared_ptr<Interest> interestA2 = makeInterest("/localhost/A2");
shared_ptr<pit::Entry> pitA2 = pit.insert(*interestA2).first;
- pitA2->insertOrUpdateInRecord(face3, *interestA2);
+ pitA2->insertOrUpdateInRecord(*face3, *interestA2);
face2->sentInterests.clear();
forwarder.onOutgoingInterest(pitA2, *face2);
BOOST_CHECK_EQUAL(face2->sentInterests.size(), 0);
@@ -281,7 +281,7 @@
// local face, non-/localhost: OK
shared_ptr<Interest> interestA3 = makeInterest("/A3");
shared_ptr<pit::Entry> pitA3 = pit.insert(*interestA3).first;
- pitA3->insertOrUpdateInRecord(face3, *interestA3);
+ pitA3->insertOrUpdateInRecord(*face3, *interestA3);
face1->sentInterests.clear();
forwarder.onOutgoingInterest(pitA3, *face1);
BOOST_CHECK_EQUAL(face1->sentInterests.size(), 1);
@@ -289,7 +289,7 @@
// non-local face, non-/localhost: OK
shared_ptr<Interest> interestA4 = makeInterest("/A4");
shared_ptr<pit::Entry> pitA4 = pit.insert(*interestA4).first;
- pitA4->insertOrUpdateInRecord(face3, *interestA4);
+ pitA4->insertOrUpdateInRecord(*face3, *interestA4);
face2->sentInterests.clear();
forwarder.onOutgoingInterest(pitA4, *face2);
BOOST_CHECK_EQUAL(face2->sentInterests.size(), 1);
@@ -331,7 +331,7 @@
// from local face, to local face: OK
shared_ptr<Interest> interest1 = makeInterest("/localhop/1");
shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
- pit1->insertOrUpdateInRecord(face1, *interest1);
+ pit1->insertOrUpdateInRecord(*face1, *interest1);
face3->sentInterests.clear();
forwarder.onOutgoingInterest(pit1, *face3);
BOOST_CHECK_EQUAL(face3->sentInterests.size(), 1);
@@ -339,7 +339,7 @@
// from non-local face, to local face: OK
shared_ptr<Interest> interest2 = makeInterest("/localhop/2");
shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
- pit2->insertOrUpdateInRecord(face2, *interest2);
+ pit2->insertOrUpdateInRecord(*face2, *interest2);
face3->sentInterests.clear();
forwarder.onOutgoingInterest(pit2, *face3);
BOOST_CHECK_EQUAL(face3->sentInterests.size(), 1);
@@ -347,7 +347,7 @@
// from local face, to non-local face: OK
shared_ptr<Interest> interest3 = makeInterest("/localhop/3");
shared_ptr<pit::Entry> pit3 = pit.insert(*interest3).first;
- pit3->insertOrUpdateInRecord(face1, *interest3);
+ pit3->insertOrUpdateInRecord(*face1, *interest3);
face4->sentInterests.clear();
forwarder.onOutgoingInterest(pit3, *face4);
BOOST_CHECK_EQUAL(face4->sentInterests.size(), 1);
@@ -355,7 +355,7 @@
// from non-local face, to non-local face: violate
shared_ptr<Interest> interest4 = makeInterest("/localhop/4");
shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
- pit4->insertOrUpdateInRecord(face2, *interest4);
+ pit4->insertOrUpdateInRecord(*face2, *interest4);
face4->sentInterests.clear();
forwarder.onOutgoingInterest(pit4, *face4);
BOOST_CHECK_EQUAL(face4->sentInterests.size(), 0);
@@ -363,8 +363,8 @@
// from local face and non-local face, to local face: OK
shared_ptr<Interest> interest5 = makeInterest("/localhop/5");
shared_ptr<pit::Entry> pit5 = pit.insert(*interest5).first;
- pit5->insertOrUpdateInRecord(face1, *interest5);
- pit5->insertOrUpdateInRecord(face2, *interest5);
+ pit5->insertOrUpdateInRecord(*face1, *interest5);
+ pit5->insertOrUpdateInRecord(*face2, *interest5);
face3->sentInterests.clear();
forwarder.onOutgoingInterest(pit5, *face3);
BOOST_CHECK_EQUAL(face3->sentInterests.size(), 1);
@@ -372,8 +372,8 @@
// from local face and non-local face, to non-local face: OK
shared_ptr<Interest> interest6 = makeInterest("/localhop/6");
shared_ptr<pit::Entry> pit6 = pit.insert(*interest6).first;
- pit6->insertOrUpdateInRecord(face1, *interest6);
- pit6->insertOrUpdateInRecord(face2, *interest6);
+ pit6->insertOrUpdateInRecord(*face1, *interest6);
+ pit6->insertOrUpdateInRecord(*face2, *interest6);
face4->sentInterests.clear();
forwarder.onOutgoingInterest(pit6, *face4);
BOOST_CHECK_EQUAL(face4->sentInterests.size(), 1);
@@ -443,15 +443,15 @@
Pit& pit = forwarder.getPit();
shared_ptr<Interest> interest0 = makeInterest("ndn:/");
shared_ptr<pit::Entry> pit0 = pit.insert(*interest0).first;
- pit0->insertOrUpdateInRecord(face1, *interest0);
+ pit0->insertOrUpdateInRecord(*face1, *interest0);
shared_ptr<Interest> interestA = makeInterest("ndn:/A");
shared_ptr<pit::Entry> pitA = pit.insert(*interestA).first;
- pitA->insertOrUpdateInRecord(face1, *interestA);
- pitA->insertOrUpdateInRecord(face2, *interestA);
+ pitA->insertOrUpdateInRecord(*face1, *interestA);
+ pitA->insertOrUpdateInRecord(*face2, *interestA);
shared_ptr<Interest> interestC = makeInterest("ndn:/A/B/C");
shared_ptr<pit::Entry> pitC = pit.insert(*interestC).first;
- pitC->insertOrUpdateInRecord(face3, *interestC);
- pitC->insertOrUpdateInRecord(face4, *interestC);
+ pitC->insertOrUpdateInRecord(*face3, *interestC);
+ pitC->insertOrUpdateInRecord(*face4, *interestC);
shared_ptr<Data> dataD = makeData("ndn:/A/B/C/D");
forwarder.onIncomingData(*face3, *dataD);
@@ -484,10 +484,10 @@
// dispatch to the correct strategy
shared_ptr<Interest> interest1 = makeInterest("/A/AYJqayrzF", 562);
shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
- pit1->insertOrUpdateOutRecord(face1, *interest1);
+ pit1->insertOrUpdateOutRecord(*face1, *interest1);
shared_ptr<Interest> interest2 = makeInterest("/B/EVyP73ru", 221);
shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
- pit2->insertOrUpdateOutRecord(face1, *interest2);
+ pit2->insertOrUpdateOutRecord(*face1, *interest2);
lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION);
strategyP.afterReceiveNack_count = 0;
@@ -520,7 +520,7 @@
// drop if no out-record
shared_ptr<Interest> interest4 = makeInterest("/Etab4KpY", 157);
shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
- pit4->insertOrUpdateOutRecord(face1, *interest4);
+ pit4->insertOrUpdateOutRecord(*face1, *interest4);
lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION);
strategyP.afterReceiveNack_count = 0;
@@ -538,7 +538,7 @@
BOOST_CHECK_EQUAL(strategyQ.afterReceiveNack_count, 0);
// drop if inFace is multi-access
- pit4->insertOrUpdateOutRecord(face3, *interest4);
+ pit4->insertOrUpdateOutRecord(*face3, *interest4);
strategyP.afterReceiveNack_count = 0;
strategyQ.afterReceiveNack_count = 0;
forwarder.onIncomingNack(*face3, nack4a);
@@ -567,7 +567,7 @@
// don't send Nack if there's no in-record
shared_ptr<Interest> interest1 = makeInterest("/fM5IVEtC", 719);
shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
- pit1->insertOrUpdateInRecord(face1, *interest1);
+ pit1->insertOrUpdateInRecord(*face1, *interest1);
face2->sentNacks.clear();
forwarder.onOutgoingNack(pit1, *face2, nackHeader);
@@ -576,9 +576,9 @@
// send Nack with correct Nonce
shared_ptr<Interest> interest2a = makeInterest("/Vi8tRm9MG3", 152);
shared_ptr<pit::Entry> pit2 = pit.insert(*interest2a).first;
- pit2->insertOrUpdateInRecord(face1, *interest2a);
+ pit2->insertOrUpdateInRecord(*face1, *interest2a);
shared_ptr<Interest> interest2b = makeInterest("/Vi8tRm9MG3", 808);
- pit2->insertOrUpdateInRecord(face2, *interest2b);
+ pit2->insertOrUpdateInRecord(*face2, *interest2b);
face1->sentNacks.clear();
forwarder.onOutgoingNack(pit2, *face1, nackHeader);
@@ -603,7 +603,7 @@
// don't send Nack to multi-access face
shared_ptr<Interest> interest2c = makeInterest("/Vi8tRm9MG3", 228);
- pit2->insertOrUpdateInRecord(face3, *interest2c);
+ pit2->insertOrUpdateInRecord(*face3, *interest2c);
face3->sentNacks.clear();
forwarder.onOutgoingNack(pit1, *face3, nackHeader);
@@ -743,7 +743,7 @@
auto interest1 = makeInterest("/net/ndnsim/www/1.html");
interest1->setLink(link->wireEncode());
shared_ptr<pit::Entry> pit1 = pit.insert(*interest1).first;
- pit1->insertOrUpdateInRecord(face1, *interest1);
+ pit1->insertOrUpdateInRecord(*face1, *interest1);
BOOST_CHECK_EQUAL(forwarder.lookupFib(*pit1).getPrefix(), "/");
BOOST_CHECK_EQUAL(interest1->hasSelectedDelegation(), false);
@@ -759,7 +759,7 @@
auto interest2 = makeInterest("/net/ndnsim/www/2.html");
interest2->setLink(link->wireEncode());
shared_ptr<pit::Entry> pit2 = pit.insert(*interest2).first;
- pit2->insertOrUpdateInRecord(face1, *interest2);
+ pit2->insertOrUpdateInRecord(*face1, *interest2);
BOOST_CHECK_EQUAL(forwarder.lookupFib(*pit2).getPrefix(), "/telia");
BOOST_REQUIRE_EQUAL(interest2->hasSelectedDelegation(), true);
@@ -776,7 +776,7 @@
auto interest3 = makeInterest("/net/ndnsim/www/3.html");
interest3->setLink(link->wireEncode());
shared_ptr<pit::Entry> pit3 = pit.insert(*interest3).first;
- pit3->insertOrUpdateInRecord(face1, *interest3);
+ pit3->insertOrUpdateInRecord(*face1, *interest3);
BOOST_CHECK_EQUAL(forwarder.lookupFib(*pit3).getPrefix(), "/ucla");
BOOST_REQUIRE_EQUAL(interest3->hasSelectedDelegation(), true);
@@ -794,7 +794,7 @@
interest4->setLink(link->wireEncode());
interest4->setSelectedDelegation("/ucla/cs");
shared_ptr<pit::Entry> pit4 = pit.insert(*interest4).first;
- pit4->insertOrUpdateInRecord(face1, *interest4);
+ pit4->insertOrUpdateInRecord(*face1, *interest4);
BOOST_CHECK_EQUAL(forwarder.lookupFib(*pit4).getPrefix(), "/ucla");
BOOST_REQUIRE_EQUAL(interest4->hasSelectedDelegation(), true);
@@ -814,7 +814,7 @@
interest5->setLink(link->wireEncode());
interest5->setSelectedDelegation("/ucla/cs");
shared_ptr<pit::Entry> pit5 = pit.insert(*interest5).first;
- pit5->insertOrUpdateInRecord(face1, *interest5);
+ pit5->insertOrUpdateInRecord(*face1, *interest5);
BOOST_CHECK_EQUAL(forwarder.lookupFib(*pit1).getPrefix(), "/net/ndnsim");
BOOST_REQUIRE_EQUAL(interest5->hasSelectedDelegation(), true);
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 2800dc7..1b8afcb 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -60,7 +60,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/H0D6i5fc");
Pit& pit = forwarder.getPit();
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
- pitEntry->insertOrUpdateInRecord(face3, *interest);
+ pitEntry->insertOrUpdateInRecord(*face3, *interest);
strategy.afterReceiveInterest(*face3, *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
@@ -94,7 +94,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/localhop/uS09bub6tm/eG3MMoP6z");
Pit& pit = forwarder.getPit();
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
@@ -117,7 +117,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/H0D6i5fc");
Pit& pit = forwarder.getPit();
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index 9adc6ab..f3b34b6 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -73,7 +73,7 @@
interest1.setInterestLifetime(time::milliseconds(8000));
shared_ptr<pit::Entry> pitEntry1 = pit.insert(interest1).first;
- pitEntry1->insertOrUpdateInRecord(face3, interest1);
+ pitEntry1->insertOrUpdateInRecord(*face3, interest1);
strategy.afterReceiveInterest(*face3, interest1, pitEntry1);
// forwards to face1 because routing says it's best
@@ -98,7 +98,7 @@
interest2.setInterestLifetime(time::milliseconds(8000));
shared_ptr<pit::Entry> pitEntry2 = pit.insert(interest2).first;
- pitEntry2->insertOrUpdateInRecord(face3, interest2);
+ pitEntry2->insertOrUpdateInRecord(*face3, interest2);
strategy.afterReceiveInterest(*face3, interest2, pitEntry2);
// forwards to face2 because it responds previously
@@ -130,7 +130,7 @@
interest1->setInterestLifetime(time::milliseconds(8000));
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
- pitEntry1->insertOrUpdateInRecord(face3, *interest1);
+ pitEntry1->insertOrUpdateInRecord(*face3, *interest1);
strategy.afterReceiveInterest(*face3, *interest1, pitEntry1);
this->advanceClocks(time::milliseconds(1));
@@ -148,7 +148,7 @@
interest2->setInterestLifetime(time::milliseconds(8000));
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
- pitEntry2->insertOrUpdateInRecord(face3, *interest2);
+ pitEntry2->insertOrUpdateInRecord(*face3, *interest2);
strategy.afterReceiveInterest(*face3, *interest2, pitEntry2);
// FIB entry is changed before doPropagate executes
@@ -182,7 +182,7 @@
interest1->setInterestLifetime(time::milliseconds(2000));
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
- pitEntry1->insertOrUpdateInRecord(face3, *interest1);
+ pitEntry1->insertOrUpdateInRecord(*face3, *interest1);
strategy.afterReceiveInterest(*face3, *interest1, pitEntry1);
limitedIo.run(2 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
@@ -204,7 +204,7 @@
interest2->setInterestLifetime(time::milliseconds(2000));
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
- pitEntry2->insertOrUpdateInRecord(face3, *interest2);
+ pitEntry2->insertOrUpdateInRecord(*face3, *interest2);
strategy.afterReceiveInterest(*face3, *interest2, pitEntry2);
limitedIo.run(3 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
@@ -236,7 +236,7 @@
interest1->setInterestLifetime(time::milliseconds(2000));
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
- pitEntry1->insertOrUpdateInRecord(face1, *interest1);
+ pitEntry1->insertOrUpdateInRecord(*face1, *interest1);
strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
limitedIo.run(1 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
@@ -252,7 +252,7 @@
this->advanceClocks(time::milliseconds(10));
// similar Interest: strategy should still forward it
- pitEntry1->insertOrUpdateInRecord(face1, *interest1);
+ pitEntry1->insertOrUpdateInRecord(*face1, *interest1);
strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
limitedIo.run(2 - strategy.sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
@@ -280,7 +280,7 @@
// Interest comes from face1, which is sole downstream
shared_ptr<Interest> interest1 = makeInterest("ndn:/tFy5HzUzD4");
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
- pitEntry1->insertOrUpdateInRecord(face1, *interest1);
+ pitEntry1->insertOrUpdateInRecord(*face1, *interest1);
strategy.afterReceiveInterest(*face1, *interest1, pitEntry1);
diff --git a/tests/daemon/fw/pit-algorithm.t.cpp b/tests/daemon/fw/pit-algorithm.t.cpp
index cf3eea0..0589e0d 100644
--- a/tests/daemon/fw/pit-algorithm.t.cpp
+++ b/tests/daemon/fw/pit-algorithm.t.cpp
@@ -62,7 +62,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/ieWRzDsCu");
pit::Entry entry(*interest);
- entry.insertOrUpdateInRecord(nonLocalFace1, *interest);
+ entry.insertOrUpdateInRecord(*nonLocalFace1, *interest);
BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), false);
BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
}
@@ -72,7 +72,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/localhost/5n1LzIt3");
pit::Entry entry(*interest);
- entry.insertOrUpdateInRecord(localFace3, *interest);
+ entry.insertOrUpdateInRecord(*localFace3, *interest);
BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), true);
BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
}
@@ -82,7 +82,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/localhop/YcIKWCRYJ");
pit::Entry entry(*interest);
- entry.insertOrUpdateInRecord(localFace3, *interest);
+ entry.insertOrUpdateInRecord(*localFace3, *interest);
BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), false);
BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
}
@@ -92,7 +92,7 @@
shared_ptr<Interest> interest = makeInterest("ndn:/localhop/x5uFr5IpqY");
pit::Entry entry(*interest);
- entry.insertOrUpdateInRecord(nonLocalFace1, *interest);
+ entry.insertOrUpdateInRecord(*nonLocalFace1, *interest);
BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), true);
BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
}
@@ -102,8 +102,8 @@
shared_ptr<Interest> interest = makeInterest("ndn:/localhop/gNn2MJAXt");
pit::Entry entry(*interest);
- entry.insertOrUpdateInRecord(nonLocalFace1, *interest);
- entry.insertOrUpdateInRecord(localFace3, *interest);
+ entry.insertOrUpdateInRecord(*nonLocalFace1, *interest);
+ entry.insertOrUpdateInRecord(*localFace3, *interest);
BOOST_CHECK_EQUAL(violatesScope(entry, *nonLocalFace2), false);
BOOST_CHECK_EQUAL(violatesScope(entry, *localFace4), false);
}
@@ -118,15 +118,15 @@
auto face1 = make_shared<DummyFace>();
auto face2 = make_shared<DummyFace>();
- entry.insertOrUpdateInRecord(face1, *interest);
+ entry.insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face1), false);
BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face2), true);
- entry.insertOrUpdateInRecord(face2, *interest);
+ entry.insertOrUpdateInRecord(*face2, *interest);
BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face1), true);
BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face2), true);
- entry.insertOrUpdateOutRecord(face1, *interest);
+ entry.insertOrUpdateOutRecord(*face1, *interest);
BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face1), false);
BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face2), true);
}
@@ -146,22 +146,22 @@
BOOST_CHECK_EQUAL(findDuplicateNonce(entry0, 19004, *face2), DUPLICATE_NONCE_NONE);
pit::Entry entry1(*interest);
- entry1.insertOrUpdateInRecord(face1, *interest);
+ entry1.insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 25559, *face1), DUPLICATE_NONCE_IN_SAME);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 25559, *face2), DUPLICATE_NONCE_IN_OTHER);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 19004, *face1), DUPLICATE_NONCE_NONE);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 19004, *face2), DUPLICATE_NONCE_NONE);
pit::Entry entry2(*interest);
- entry2.insertOrUpdateOutRecord(face1, *interest);
+ entry2.insertOrUpdateOutRecord(*face1, *interest);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 25559, *face1), DUPLICATE_NONCE_OUT_SAME);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 25559, *face2), DUPLICATE_NONCE_OUT_OTHER);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 19004, *face1), DUPLICATE_NONCE_NONE);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 19004, *face2), DUPLICATE_NONCE_NONE);
pit::Entry entry3(*interest);
- entry3.insertOrUpdateInRecord(face1, *interest);
- entry3.insertOrUpdateOutRecord(face1, *interest);
+ entry3.insertOrUpdateInRecord(*face1, *interest);
+ entry3.insertOrUpdateOutRecord(*face1, *interest);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry3, 25559, *face1),
DUPLICATE_NONCE_IN_SAME | DUPLICATE_NONCE_OUT_SAME);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry3, 25559, *face2),
@@ -170,8 +170,8 @@
BOOST_CHECK_EQUAL(findDuplicateNonce(entry3, 19004, *face2), DUPLICATE_NONCE_NONE);
pit::Entry entry4(*interest);
- entry4.insertOrUpdateInRecord(face1, *interest);
- entry4.insertOrUpdateInRecord(face2, *interest);
+ entry4.insertOrUpdateInRecord(*face1, *interest);
+ entry4.insertOrUpdateInRecord(*face2, *interest);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry4, 25559, *face1),
DUPLICATE_NONCE_IN_SAME | DUPLICATE_NONCE_IN_OTHER);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry4, 25559, *face2),
@@ -180,8 +180,8 @@
BOOST_CHECK_EQUAL(findDuplicateNonce(entry4, 19004, *face2), DUPLICATE_NONCE_NONE);
pit::Entry entry5(*interest);
- entry5.insertOrUpdateOutRecord(face1, *interest);
- entry5.insertOrUpdateOutRecord(face2, *interest);
+ entry5.insertOrUpdateOutRecord(*face1, *interest);
+ entry5.insertOrUpdateOutRecord(*face2, *interest);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry5, 25559, *face1),
DUPLICATE_NONCE_OUT_SAME | DUPLICATE_NONCE_OUT_OTHER);
BOOST_CHECK_EQUAL(findDuplicateNonce(entry5, 25559, *face2),
@@ -203,13 +203,13 @@
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
// Interest-Data
- entry.insertOrUpdateOutRecord(face1, *interest);
+ entry.insertOrUpdateOutRecord(*face1, *interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true);
entry.deleteOutRecord(*face1);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
// Interest-Nack
- entry.insertOrUpdateOutRecord(face2, *interest);
+ entry.insertOrUpdateOutRecord(*face2, *interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true);
pit::OutRecordCollection::iterator outR = entry.getOutRecord(*face2);
BOOST_REQUIRE(outR != entry.out_end());
@@ -219,7 +219,7 @@
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
// Interest-timeout
- entry.insertOrUpdateOutRecord(face3, *interest);
+ entry.insertOrUpdateOutRecord(*face3, *interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true);
this->advanceClocks(ndn::DEFAULT_INTEREST_LIFETIME, 2);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp
index 266f168..7013aef 100644
--- a/tests/daemon/fw/retx-suppression.t.cpp
+++ b/tests/daemon/fw/retx-suppression.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -59,31 +59,31 @@
time::duration_cast<time::nanoseconds>(MIN_RETX_INTERVAL * 0.1);
// @ time 0
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::NEW);
- pitEntry->insertOrUpdateOutRecord(face3, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face3, *interest);
this->advanceClocks(RETRANSMISSION_10P, 5); // @ time 0.5 interval
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
- pitEntry->insertOrUpdateInRecord(face2, *interest);
+ pitEntry->insertOrUpdateInRecord(*face2, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetxSuppression::SUPPRESS);
this->advanceClocks(RETRANSMISSION_10P, 6); // @ time 1.1 interval
- pitEntry->insertOrUpdateInRecord(face2, *interest);
+ pitEntry->insertOrUpdateInRecord(*face2, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetxSuppression::FORWARD);
// but strategy decides not to forward
this->advanceClocks(RETRANSMISSION_10P, 1); // @ time 1.2 interval
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::FORWARD);
// retransmission suppress shall still give clearance for forwarding
- pitEntry->insertOrUpdateOutRecord(face3, *interest); // and strategy forwards
+ pitEntry->insertOrUpdateOutRecord(*face3, *interest); // and strategy forwards
this->advanceClocks(RETRANSMISSION_10P, 2); // @ time 1.4 interval
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
- pitEntry->insertOrUpdateInRecord(face2, *interest);
+ pitEntry->insertOrUpdateInRecord(*face2, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face2, *interest, *pitEntry), RetxSuppression::SUPPRESS);
}
@@ -102,13 +102,13 @@
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
// @ 0ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::NEW);
- pitEntry->insertOrUpdateOutRecord(face2, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face2, *interest);
// suppression interval is 10ms, until 10ms
this->advanceClocks(time::milliseconds(5)); // @ 5ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
// suppression interval is 10ms, until 10ms
@@ -116,42 +116,42 @@
// note: what happens at *exactly* 10ms does not matter so it's untested,
// because in reality network timing won't be exact:
// incoming Interest is processed either before or after 10ms point
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::FORWARD);
- pitEntry->insertOrUpdateOutRecord(face2, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face2, *interest);
// suppression interval is 30ms, until 41ms
this->advanceClocks(time::milliseconds(25)); // @ 36ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
// suppression interval is 30ms, until 41ms
this->advanceClocks(time::milliseconds(6)); // @ 42ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::FORWARD);
// strategy decides not to forward, but suppression interval is increased nevertheless
// suppression interval is 90ms, until 101ms
this->advanceClocks(time::milliseconds(58)); // @ 100ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
// suppression interval is 90ms, until 101ms
this->advanceClocks(time::milliseconds(3)); // @ 103ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::FORWARD);
- pitEntry->insertOrUpdateOutRecord(face2, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face2, *interest);
// suppression interval is 100ms, until 203ms
this->advanceClocks(time::milliseconds(99)); // @ 202ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::SUPPRESS);
// suppression interval is 100ms, until 203ms
this->advanceClocks(time::milliseconds(2)); // @ 204ms
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK_EQUAL(rs.decide(*face1, *interest, *pitEntry), RetxSuppression::FORWARD);
- pitEntry->insertOrUpdateOutRecord(face2, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face2, *interest);
// suppression interval is 100ms, until 304ms
}
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index da79517..3840438 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -96,7 +96,7 @@
{
SendInterestArgs args{pitEntry, outFace.getId(), wantNewNonce};
sendInterestHistory.push_back(args);
- pitEntry->insertOrUpdateOutRecord(outFace.shared_from_this(), pitEntry->getInterest());
+ pitEntry->insertOrUpdateOutRecord(outFace, pitEntry->getInterest());
afterAction();
}
diff --git a/tests/daemon/table/cleanup.t.cpp b/tests/daemon/table/cleanup.t.cpp
index 0df019c..20638ab 100644
--- a/tests/daemon/table/cleanup.t.cpp
+++ b/tests/daemon/table/cleanup.t.cpp
@@ -55,10 +55,10 @@
shared_ptr<Interest> interest = makeInterest(name);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
if ((i & 0x01) != 0) {
- pitEntry->insertOrUpdateInRecord(face1, *interest);
+ pitEntry->insertOrUpdateInRecord(*face1, *interest);
}
if ((i & 0x02) != 0) {
- pitEntry->insertOrUpdateOutRecord(face1, *interest);
+ pitEntry->insertOrUpdateOutRecord(*face1, *interest);
}
}
BOOST_CHECK_EQUAL(fib.size(), 300);
@@ -144,22 +144,22 @@
shared_ptr<Interest> interestA = makeInterest("/A");
shared_ptr<pit::Entry> entryA = pit.insert(*interestA).first;
- entryA->insertOrUpdateInRecord(face1, *interestA);
- entryA->insertOrUpdateInRecord(face2, *interestA);
- entryA->insertOrUpdateOutRecord(face1, *interestA);
- entryA->insertOrUpdateOutRecord(face2, *interestA);
+ entryA->insertOrUpdateInRecord(*face1, *interestA);
+ entryA->insertOrUpdateInRecord(*face2, *interestA);
+ entryA->insertOrUpdateOutRecord(*face1, *interestA);
+ entryA->insertOrUpdateOutRecord(*face2, *interestA);
// {'/A':[1,2]}
shared_ptr<Interest> interestB = makeInterest("/B");
shared_ptr<pit::Entry> entryB = pit.insert(*interestB).first;
- entryB->insertOrUpdateInRecord(face1, *interestB);
- entryB->insertOrUpdateOutRecord(face1, *interestB);
+ entryB->insertOrUpdateInRecord(*face1, *interestB);
+ entryB->insertOrUpdateOutRecord(*face1, *interestB);
// {'/A':[1,2], '/B':[1]}
shared_ptr<Interest> interestC = makeInterest("/C");
shared_ptr<pit::Entry> entryC = pit.insert(*interestC).first;
- entryC->insertOrUpdateInRecord(face2, *interestC);
- entryC->insertOrUpdateOutRecord(face2, *interestC);
+ entryC->insertOrUpdateInRecord(*face2, *interestC);
+ entryC->insertOrUpdateOutRecord(*face2, *interestC);
// {'/A':[1,2], '/B':[1], '/C':[2]}
BOOST_CHECK_EQUAL(pit.size(), 3);
@@ -172,9 +172,9 @@
shared_ptr<pit::Entry> foundA = pit.find(*interestA);
BOOST_REQUIRE(foundA != nullptr);
BOOST_REQUIRE_EQUAL(foundA->getInRecords().size(), 1);
- BOOST_CHECK_EQUAL(foundA->getInRecords().front().getFace(), face2);
+ BOOST_CHECK_EQUAL(&foundA->getInRecords().front().getFace(), face2.get());
BOOST_REQUIRE_EQUAL(foundA->getOutRecords().size(), 1);
- BOOST_CHECK_EQUAL(foundA->getOutRecords().front().getFace(), face2);
+ BOOST_CHECK_EQUAL(&foundA->getOutRecords().front().getFace(), face2.get());
}
BOOST_AUTO_TEST_SUITE_END() // FaceRemovalCleanup
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 0418f7e..6135502 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -70,12 +70,12 @@
// insert in-record
time::steady_clock::TimePoint before1 = time::steady_clock::now();
- InRecordCollection::iterator in1 = entry.insertOrUpdateInRecord(face1, *interest1);
+ InRecordCollection::iterator in1 = entry.insertOrUpdateInRecord(*face1, *interest1);
time::steady_clock::TimePoint after1 = time::steady_clock::now();
const InRecordCollection& inRecords2 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords2.size(), 1);
BOOST_CHECK(in1 == inRecords2.begin());
- BOOST_CHECK_EQUAL(in1->getFace(), face1);
+ BOOST_CHECK_EQUAL(&in1->getFace(), face1.get());
BOOST_CHECK_EQUAL(in1->getLastNonce(), interest1->getNonce());
BOOST_CHECK_GE(in1->getLastRenewed(), before1);
BOOST_CHECK_LE(in1->getLastRenewed(), after1);
@@ -86,12 +86,12 @@
// insert out-record
time::steady_clock::TimePoint before2 = time::steady_clock::now();
- OutRecordCollection::iterator out1 = entry.insertOrUpdateOutRecord(face1, *interest1);
+ OutRecordCollection::iterator out1 = entry.insertOrUpdateOutRecord(*face1, *interest1);
time::steady_clock::TimePoint after2 = time::steady_clock::now();
const OutRecordCollection& outRecords2 = entry.getOutRecords();
BOOST_CHECK_EQUAL(outRecords2.size(), 1);
BOOST_CHECK(out1 == outRecords2.begin());
- BOOST_CHECK_EQUAL(out1->getFace(), face1);
+ BOOST_CHECK_EQUAL(&out1->getFace(), face1.get());
BOOST_CHECK_EQUAL(out1->getLastNonce(), interest1->getNonce());
BOOST_CHECK_GE(out1->getLastRenewed(), before2);
BOOST_CHECK_LE(out1->getLastRenewed(), after2);
@@ -102,27 +102,27 @@
// update in-record
time::steady_clock::TimePoint before3 = time::steady_clock::now();
- InRecordCollection::iterator in2 = entry.insertOrUpdateInRecord(face1, *interest2);
+ InRecordCollection::iterator in2 = entry.insertOrUpdateInRecord(*face1, *interest2);
time::steady_clock::TimePoint after3 = time::steady_clock::now();
const InRecordCollection& inRecords3 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords3.size(), 1);
BOOST_CHECK(in2 == inRecords3.begin());
- BOOST_CHECK_EQUAL(in2->getFace(), face1);
+ BOOST_CHECK_EQUAL(&in2->getFace(), face1.get());
BOOST_CHECK_EQUAL(in2->getLastNonce(), interest2->getNonce());
BOOST_CHECK_LE(in2->getExpiry() - in2->getLastRenewed()
- interest2->getInterestLifetime(),
(after3 - before3));
// insert another in-record
- InRecordCollection::iterator in3 = entry.insertOrUpdateInRecord(face2, *interest3);
+ InRecordCollection::iterator in3 = entry.insertOrUpdateInRecord(*face2, *interest3);
const InRecordCollection& inRecords4 = entry.getInRecords();
BOOST_CHECK_EQUAL(inRecords4.size(), 2);
- BOOST_CHECK_EQUAL(in3->getFace(), face2);
+ BOOST_CHECK_EQUAL(&in3->getFace(), face2.get());
// get in-record
InRecordCollection::iterator in4 = entry.getInRecord(*face1);
BOOST_REQUIRE(in4 != entry.in_end());
- BOOST_CHECK_EQUAL(in4->getFace(), face1);
+ BOOST_CHECK_EQUAL(&in4->getFace(), face1.get());
// clear in-records
entry.clearInRecords();
@@ -132,21 +132,21 @@
// insert another out-record
OutRecordCollection::iterator out2 =
- entry.insertOrUpdateOutRecord(face2, *interest4);
+ entry.insertOrUpdateOutRecord(*face2, *interest4);
const OutRecordCollection& outRecords3 = entry.getOutRecords();
BOOST_CHECK_EQUAL(outRecords3.size(), 2);
- BOOST_CHECK_EQUAL(out2->getFace(), face2);
+ BOOST_CHECK_EQUAL(&out2->getFace(), face2.get());
// get out-record
OutRecordCollection::iterator out3 = entry.getOutRecord(*face1);
BOOST_REQUIRE(out3 != entry.out_end());
- BOOST_CHECK_EQUAL(out3->getFace(), face1);
+ BOOST_CHECK_EQUAL(&out3->getFace(), face1.get());
// delete out-record
entry.deleteOutRecord(*face2);
const OutRecordCollection& outRecords4 = entry.getOutRecords();
BOOST_REQUIRE_EQUAL(outRecords4.size(), 1);
- BOOST_CHECK_EQUAL(outRecords4.begin()->getFace(), face1);
+ BOOST_CHECK_EQUAL(&outRecords4.begin()->getFace(), face1.get());
BOOST_CHECK(entry.getOutRecord(*face2) == entry.out_end());
}
@@ -159,17 +159,17 @@
shared_ptr<Face> face = make_shared<DummyFace>();
Entry entry(*interest);
- InRecordCollection::iterator inIt = entry.insertOrUpdateInRecord(face, *interest);
+ InRecordCollection::iterator inIt = entry.insertOrUpdateInRecord(*face, *interest);
BOOST_CHECK_GT(inIt->getExpiry(), time::steady_clock::now());
- OutRecordCollection::iterator outIt = entry.insertOrUpdateOutRecord(face, *interest);
+ OutRecordCollection::iterator outIt = entry.insertOrUpdateOutRecord(*face, *interest);
BOOST_CHECK_GT(outIt->getExpiry(), time::steady_clock::now());
}
BOOST_AUTO_TEST_CASE(OutRecordNack)
{
shared_ptr<Face> face1 = make_shared<DummyFace>();
- OutRecord outR(face1);
+ OutRecord outR(*face1);
BOOST_CHECK(outR.getIncomingNack() == nullptr);
shared_ptr<Interest> interest1 = makeInterest("ndn:/uWiapGjYL");