table: optimize removal of PIT in-records
Most call sites already have an iterator that can be used directly,
so change deleteInRecord() to accept an iterator instead of doing
another list lookup.
Change-Id: Ie097f4bc4b13e7428e0580ed7cf4dcb506a009f7
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 10610ad..712e200 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -248,20 +248,19 @@
{
BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
- shared_ptr<lp::PitToken> pitToken;
auto inRecord = pitEntry->getInRecord(egress);
if (inRecord != pitEntry->in_end()) {
- pitToken = inRecord->getInterest().getTag<lp::PitToken>();
- }
+ auto pitToken = inRecord->getInterest().getTag<lp::PitToken>();
- // delete the PIT entry's in-record based on egress,
- // since the Data is sent to the face from which the Interest was received
- pitEntry->deleteInRecord(egress);
+ // delete the PIT entry's in-record based on egress,
+ // since the Data is sent to the face from which the Interest was received
+ pitEntry->deleteInRecord(inRecord);
- if (pitToken != nullptr) {
- Data data2 = data; // make a copy so each downstream can get a different PIT token
- data2.setTag(pitToken);
- return m_forwarder.onOutgoingData(data2, egress);
+ if (pitToken != nullptr) {
+ Data data2 = data; // make a copy so each downstream can get a different PIT token
+ data2.setTag(pitToken);
+ return m_forwarder.onOutgoingData(data2, egress);
+ }
}
return m_forwarder.onOutgoingData(data, egress);
}