Revert "pit: add EndpointId field in in-record and out-record"
This reverts commit d3ae85dbad518da84d0ef5ba61b81108e40f84f3.
refs: #4973
Change-Id: I0aedfca8ae75137c8c9073a51642bfacf9d8f212
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 6ae2767..51f7c8d 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -172,7 +172,7 @@
return;
}
- auto inRecord = pitEntry->getInRecord(*inFace, inEndpointId);
+ auto inRecord = pitEntry->getInRecord(*inFace);
// in-record is erased only if Interest is satisfied, and RTO timer should have been cancelled
// note: if this strategy is extended to send Nacks, that would also erase the in-record,
// and the RTO timer should be cancelled in that case as well
@@ -219,7 +219,7 @@
return;
}
- auto outRecord = pitEntry->getOutRecord(ingress.face, 0);
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) { // no out-record
NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << ingress << " no-out-record");
return;
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index 6ea610f..1ed699b 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -140,7 +140,7 @@
if (!isNextHopEligible(inFace, interest, *it, pitEntry))
continue;
- auto outRecord = pitEntry->getOutRecord(it->getFace(), 0);
+ auto outRecord = pitEntry->getOutRecord(it->getFace());
BOOST_ASSERT(outRecord != pitEntry->out_end());
if (outRecord->getLastRenewed() < earliestRenewed) {
found = it;
@@ -166,7 +166,7 @@
if (wantUnused) {
// nexthop must not have unexpired out-record
- auto outRecord = pitEntry->getOutRecord(outFace, 0);
+ auto outRecord = pitEntry->getOutRecord(outFace);
if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
return false;
}
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 62336eb..90b4ebe 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -181,7 +181,7 @@
return;
}
- auto outRecord = pitEntry->getOutRecord(ingress.face, 0);
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DEBUG(pitEntry->getName() << " data from=" << ingress << " no-out-record");
}
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 4c60129..4c91fb7 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -167,13 +167,8 @@
NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName());
++m_counters.nCsMisses;
- // FIXME Strategies are not prepared to handle non-zero EndpointIds, so always insert
- // the in-record and dispatch to strategy with EndpointId=0 for now. Eventually,
- // this pipeline will need to be refactored so that strategies can control the
- // in-record insertion.
-
// insert in-record
- pitEntry->insertOrUpdateInRecord(ingress.face, 0, interest);
+ pitEntry->insertOrUpdateInRecord(ingress.face, interest);
// set PIT expiry timer to the time that the last PIT in-record expires
auto lastExpiring = std::max_element(pitEntry->in_begin(), pitEntry->in_end(),
@@ -233,7 +228,7 @@
NFD_LOG_DEBUG("onOutgoingInterest out=" << egress << " interest=" << pitEntry->getName());
// insert out-record
- pitEntry->insertOrUpdateOutRecord(egress.face, egress.endpoint, interest);
+ pitEntry->insertOrUpdateOutRecord(egress.face, interest);
// send Interest
egress.face.sendInterest(interest, egress.endpoint);
@@ -311,7 +306,7 @@
this->insertDeadNonceList(*pitEntry, &ingress.face);
// delete PIT entry's out-record
- pitEntry->deleteOutRecord(ingress.face, ingress.endpoint);
+ pitEntry->deleteOutRecord(ingress.face);
}
// when more than one PIT entry is matched, trigger strategy: before satisfy Interest,
// and send Data to all matched out faces
@@ -325,7 +320,7 @@
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
- pendingDownstreams.emplace(&inRecord.getFace(), inRecord.getEndpointId());
+ pendingDownstreams.emplace(&inRecord.getFace(), 0);
}
}
@@ -345,7 +340,7 @@
// clear PIT entry's in and out records
pitEntry->clearInRecords();
- pitEntry->deleteOutRecord(ingress.face, ingress.endpoint);
+ pitEntry->deleteOutRecord(ingress.face);
}
// foreach pending downstream
@@ -424,7 +419,7 @@
}
// has out-record?
- auto outRecord = pitEntry->getOutRecord(ingress.face, ingress.endpoint);
+ auto outRecord = pitEntry->getOutRecord(ingress.face);
// if no out-record found, drop
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
@@ -467,7 +462,7 @@
}
// has in-record?
- auto inRecord = pitEntry->getInRecord(egress.face, egress.endpoint);
+ auto inRecord = pitEntry->getInRecord(egress.face);
// if no in-record found, drop
if (inRecord == pitEntry->in_end()) {
@@ -494,7 +489,7 @@
nackPkt.setHeader(nack);
// erase in-record
- pitEntry->deleteInRecord(egress.face, egress.endpoint);
+ pitEntry->deleteInRecord(egress.face);
// send Nack on face
egress.face.sendNack(nackPkt, egress.endpoint);
@@ -542,7 +537,7 @@
}
else {
// insert outgoing Nonce of a specific face
- auto outRecord = pitEntry.getOutRecord(*upstream, 0);
+ auto outRecord = pitEntry.getOutRecord(*upstream);
if (outRecord != pitEntry.getOutRecords().end()) {
m_deadNonceList.add(pitEntry.getName(), outRecord->getLastNonce());
}
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index d15063e..d861071 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -93,7 +93,7 @@
NFD_LOG_DEBUG(interest << " from=" << ingress << " pitEntry-to=" << outFace.getId());
if (suppressResult == RetxSuppressionResult::FORWARD) {
- m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace, 0));
+ m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace));
}
++nEligibleNextHops;
}
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index 4969a14..9909272 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -143,7 +143,7 @@
if (pitEntry == nullptr) {
return;
}
- auto inRecord = pitEntry->getInRecord(*inFace, 0);
+ auto inRecord = pitEntry->getInRecord(*inFace);
if (inRecord == pitEntry->in_end()) {
return;
}
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index 6f3ad08..ed599d9 100644
--- a/daemon/fw/process-nack-traits.cpp
+++ b/daemon/fw/process-nack-traits.cpp
@@ -56,7 +56,7 @@
if (nOutRecordsNotNacked == 1) {
BOOST_ASSERT(lastFaceNotNacked != nullptr);
- pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked, 0);
+ pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
if (inR != pitEntry->in_end()) {
// one out-record not Nacked, which is also a downstream
NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() <<
diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp
index 1275dd9..c634173 100644
--- a/daemon/fw/retx-suppression-exponential.cpp
+++ b/daemon/fw/retx-suppression-exponential.cpp
@@ -95,7 +95,7 @@
RetxSuppressionExponential::decidePerUpstream(pit::Entry& pitEntry, Face& outFace)
{
// NEW if outRecord for the face does not exist
- auto outRecord = pitEntry.getOutRecord(outFace, 0);
+ auto outRecord = pitEntry.getOutRecord(outFace);
if (outRecord == pitEntry.out_end()) {
return RetxSuppressionResult::NEW;
}
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index fd6d16e..a77d3ef 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -73,7 +73,7 @@
const fib::NextHopList& nexthops = fibEntry.getNextHops();
bool isNonDiscovery = interest.getTag<lp::NonDiscoveryTag>() != nullptr;
- auto inRecordInfo = pitEntry->getInRecord(ingress.face, ingress.endpoint)->insertStrategyInfo<InRecordInfo>().first;
+ auto inRecordInfo = pitEntry->getInRecord(ingress.face)->insertStrategyInfo<InRecordInfo>().first;
if (isNonDiscovery) { // "non-discovery" Interest
inRecordInfo->isNonDiscoveryInterest = true;
if (nexthops.empty()) { // return NACK if no matching FIB entry exists
@@ -103,7 +103,7 @@
SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
const FaceEndpoint& ingress, const Data& data)
{
- OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(ingress.face, ingress.endpoint)->getStrategyInfo<OutRecordInfo>();
+ OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(ingress.face)->getStrategyInfo<OutRecordInfo>();
if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
sendDataToAll(pitEntry, ingress, data);
@@ -147,7 +147,7 @@
continue;
}
this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
- pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
+ pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
NFD_LOG_DEBUG("send discovery Interest=" << interest << " from="
<< inFace.getId() << " to=" << outFace.getId());
}
@@ -165,7 +165,7 @@
continue;
}
this->sendInterest(pitEntry, FaceEndpoint(outFace, 0), interest);
- pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
+ pitEntry->getOutRecord(outFace)->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from="
<< inFace.getId() << " to=" << outFace.getId());
}
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 151dac8..b4ccda8 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -199,7 +199,7 @@
// delete the PIT entry's in-record based on egress,
// since Data is sent to face and endpoint from which the Interest was received
- pitEntry->deleteInRecord(egress.face, egress.endpoint);
+ pitEntry->deleteInRecord(egress.face);
m_forwarder.onOutgoingData(data, egress);
}
@@ -208,23 +208,22 @@
Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
const FaceEndpoint& ingress, const Data& data)
{
- std::set<std::pair<Face*, EndpointId>> pendingDownstreams;
+ std::set<Face*> pendingDownstreams;
auto now = time::steady_clock::now();
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
if (inRecord.getFace().getId() == ingress.face.getId() &&
- inRecord.getEndpointId() == ingress.endpoint &&
inRecord.getFace().getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
continue;
}
- pendingDownstreams.emplace(&inRecord.getFace(), inRecord.getEndpointId());
+ pendingDownstreams.emplace(&inRecord.getFace());
}
}
for (const auto& pendingDownstream : pendingDownstreams) {
- this->sendData(pitEntry, data, FaceEndpoint(*pendingDownstream.first, pendingDownstream.second));
+ this->sendData(pitEntry, data, FaceEndpoint(*pendingDownstream, 0));
}
}
@@ -233,20 +232,20 @@
std::initializer_list<FaceEndpoint> exceptFaceEndpoints)
{
// populate downstreams with all downstreams faces
- std::set<std::pair<Face*, EndpointId>> downstreams;
+ std::set<Face*> downstreams;
std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
[] (const pit::InRecord& inR) {
- return std::make_pair(&inR.getFace(), inR.getEndpointId());
+ return &inR.getFace();
});
// delete excluded faces
for (const auto& exceptFaceEndpoint : exceptFaceEndpoints) {
- downstreams.erase({&exceptFaceEndpoint.face, exceptFaceEndpoint.endpoint});
+ downstreams.erase(&exceptFaceEndpoint.face);
}
// send Nacks
for (const auto& downstream : downstreams) {
- this->sendNack(pitEntry, FaceEndpoint(*downstream.first, downstream.second), header);
+ this->sendNack(pitEntry, FaceEndpoint(*downstream, 0), header);
}
// warning: don't loop on pitEntry->getInRecords(), because in-record is deleted when sending Nack
}