model: (Re-)Implementing ability to keep PIT records after Interest is getting satisfied
Default behavior remained the same.
As part of this commit, a small extension (and bug fix) in trie data
structure, allowing search with predicates (e.g., used to lookup a
non-empty PIT entry during Lookup on ContentObject header).
diff --git a/model/pit/ndn-pit-impl.cc b/model/pit/ndn-pit-impl.cc
index 3b693f8..27fcab2 100644
--- a/model/pit/ndn-pit-impl.cc
+++ b/model/pit/ndn-pit-impl.cc
@@ -185,7 +185,7 @@
PitImpl<Policy>::Lookup (const ContentObjectHeader &header)
{
/// @todo use predicate to search with exclude filters
- typename super::iterator item = super::longest_prefix_match (header.GetName ());
+ typename super::iterator item = super::longest_prefix_match_if (header.GetName (), EntryIsNotEmpty ());
if (item == super::end ())
return 0;
@@ -249,8 +249,14 @@
void
PitImpl<Policy>::MarkErased (Ptr<Entry> item)
{
- // entry->SetExpireTime (Simulator::Now () + m_PitEntryPruningTimout);
- super::erase (StaticCast< entry > (item)->to_iterator ());
+ if (this->m_PitEntryPruningTimout.IsZero ())
+ {
+ super::erase (StaticCast< entry > (item)->to_iterator ());
+ }
+ else
+ {
+ item->OffsetLifetime (this->m_PitEntryPruningTimout - item->GetExpireTime () + Simulator::Now ());
+ }
}