fw: remove EndpointId from egress APIs
This commit partially reverts c70794810592a90847656a97caf27f0326668240
refs: #4849, #4973
Change-Id: I1063e5de2c0e3c90971c4ae006ce46de386c2ed0
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index d33ad9a..785cc8b 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -165,7 +165,7 @@
NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName()
<< " in=" << ingress << " data=" << data.getName());
- this->sendData(pitEntry, data, ingress);
+ this->sendData(pitEntry, data, ingress.face);
}
void
@@ -177,25 +177,24 @@
this->beforeSatisfyInterest(pitEntry, ingress, data);
- this->sendDataToAll(pitEntry, ingress, data);
+ this->sendDataToAll(pitEntry, ingress.face, data);
}
void
-Strategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+Strategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack&,
const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG("afterReceiveNack in=" << ingress << " pitEntry=" << pitEntry->getName());
}
void
-Strategy::onDroppedInterest(const FaceEndpoint& egress, const Interest& interest)
+Strategy::onDroppedInterest(const Face& egress, const Interest& interest)
{
- NFD_LOG_DEBUG("onDroppedInterest out=" << egress << " name=" << interest.getName());
+ NFD_LOG_DEBUG("onDroppedInterest out=" << egress.getId() << " name=" << interest.getName());
}
void
-Strategy::sendInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& egress, const Interest& interest)
+Strategy::sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress, const Interest& interest)
{
if (interest.getTag<lp::PitToken>() != nullptr) {
Interest interest2 = interest; // make a copy to preserve tag on original packet
@@ -214,20 +213,19 @@
}
void
-Strategy::sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data,
- const FaceEndpoint& egress)
+Strategy::sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, Face& egress)
{
BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
shared_ptr<lp::PitToken> pitToken;
- auto inRecord = pitEntry->getInRecord(egress.face);
+ auto inRecord = pitEntry->getInRecord(egress);
if (inRecord != pitEntry->in_end()) {
pitToken = inRecord->getInterest().getTag<lp::PitToken>();
}
// 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);
+ // since the Data is sent to the face from which the Interest was received
+ pitEntry->deleteInRecord(egress);
if (pitToken != nullptr) {
Data data2 = data; // make a copy so each downstream can get a different PIT token
@@ -240,7 +238,7 @@
void
Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+ const Face& inFace, const Data& data)
{
std::set<Face*> pendingDownstreams;
auto now = time::steady_clock::now();
@@ -248,7 +246,7 @@
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
- if (inRecord.getFace().getId() == ingress.face.getId() &&
+ if (inRecord.getFace().getId() == inFace.getId() &&
inRecord.getFace().getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
continue;
}
@@ -257,29 +255,27 @@
}
for (const auto& pendingDownstream : pendingDownstreams) {
- this->sendData(pitEntry, data, FaceEndpoint(*pendingDownstream, 0));
+ this->sendData(pitEntry, data, *pendingDownstream);
}
}
void
Strategy::sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
- std::initializer_list<FaceEndpoint> exceptFaceEndpoints)
+ std::initializer_list<const Face*> exceptFaces)
{
// populate downstreams with all downstreams faces
- std::set<Face*> downstreams;
+ std::unordered_set<Face*> downstreams;
std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
- [] (const pit::InRecord& inR) {
- return &inR.getFace();
- });
+ [] (const pit::InRecord& inR) { return &inR.getFace(); });
// delete excluded faces
- for (const auto& exceptFaceEndpoint : exceptFaceEndpoints) {
- downstreams.erase(&exceptFaceEndpoint.face);
+ for (auto exceptFace : exceptFaces) {
+ downstreams.erase(const_cast<Face*>(exceptFace));
}
// send Nacks
- for (const auto& downstream : downstreams) {
- this->sendNack(pitEntry, FaceEndpoint(*downstream, 0), header);
+ for (auto downstream : downstreams) {
+ this->sendNack(pitEntry, *downstream, header);
}
// warning: don't loop on pitEntry->getInRecords(), because in-record is deleted when sending Nack
}