fw: add strategy notification for Interests dropped by LpReliability
add dropped Interest counter to faces
refs #3823
Change-Id: I9910b66932d74383203e8f3732bb45cade83b972
diff --git a/daemon/face/lp-reliability.cpp b/daemon/face/lp-reliability.cpp
index 2b587f9..0df5702 100644
--- a/daemon/face/lp-reliability.cpp
+++ b/daemon/face/lp-reliability.cpp
@@ -61,14 +61,14 @@
}
void
-LpReliability::handleOutgoing(std::vector<lp::Packet>& frags)
+LpReliability::handleOutgoing(std::vector<lp::Packet>& frags, lp::Packet&& pkt, bool isInterest)
{
BOOST_ASSERT(m_options.isEnabled);
auto unackedFragsIt = m_unackedFrags.begin();
auto sendTime = time::steady_clock::now();
- auto netPkt = make_shared<NetPkt>();
+ auto netPkt = make_shared<NetPkt>(std::move(pkt), isInterest);
netPkt->unackedFrags.reserve(frags.size());
for (lp::Packet& frag : frags) {
@@ -250,6 +250,16 @@
}
++m_linkService->nRetxExhausted;
+
+ // Notify strategy of dropped Interest (if any)
+ if (netPkt->isInterest) {
+ BOOST_ASSERT(netPkt->pkt.has<lp::FragmentField>());
+ ndn::Buffer::const_iterator fragBegin, fragEnd;
+ std::tie(fragBegin, fragEnd) = netPkt->pkt.get<lp::FragmentField>();
+ Block frag(&*fragBegin, std::distance(fragBegin, fragEnd));
+ onDroppedInterest(Interest(frag));
+ }
+
deleteUnackedFrag(txSeqIt);
}
else {
@@ -337,5 +347,12 @@
{
}
+LpReliability::NetPkt::NetPkt(lp::Packet&& pkt, bool isInterest)
+ : pkt(std::move(pkt))
+ , isInterest(isInterest)
+ , didRetx(false)
+{
+}
+
} // namespace face
} // namespace nfd