Several important corrections. Adding option to delay data at every node (random from 0.1 to 2 ms)
diff --git a/model/ccnx-pit.cc b/model/ccnx-pit.cc
index ead991c..a68c4a7 100644
--- a/model/ccnx-pit.cc
+++ b/model/ccnx-pit.cc
@@ -140,7 +140,7 @@
m_fib = fib;
}
-const CcnxPitEntry&
+CcnxPitEntryContainer::type::iterator
CcnxPit::Lookup (const CcnxContentObjectHeader &header) const
{
// NS_LOG_FUNCTION_NOARGS ();
@@ -157,19 +157,16 @@
entry = get<i_prefix> ().find (subPrefix);
if (entry != end())
- return *entry;
+ return entry;
}
- if (entry == end ())
- throw CcnxPitEntryNotFound();
-
- return *entry;
+ throw CcnxPitEntryNotFound();
}
boost::tuple<const CcnxPitEntry&, bool, bool>
CcnxPit::Lookup (const CcnxInterestHeader &header)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (header.GetName ());
NS_ASSERT_MSG (m_fib != 0, "FIB should be set");
bool isDuplicate = false;
@@ -195,7 +192,17 @@
}
else
{
- isNew = false;
+ NS_LOG_INFO ("ExpireTime: " << entry->m_expireTime.ToDouble (Time::S));
+ if (entry->m_expireTime - Simulator::Now () < MilliSeconds (10))
+ {
+ modify (entry,
+ boost::bind(&CcnxPitEntry::ClearIncoming, boost::lambda::_1));
+
+ modify (entry,
+ boost::bind(&CcnxPitEntry::ClearOutgoing, boost::lambda::_1));
+ }
+
+ isNew = entry->m_incoming.size () == 0 && entry->m_outgoing.size () == 0; // entry was preserved to detect loops, but technically removed
isDuplicate = entry->IsNonceSeen (header.GetNonce ());
}
@@ -212,7 +219,7 @@
{
BOOST_FOREACH (const CcnxPitEntry &entry, pit)
{
- os << entry;
+ os << entry << std::endl;
}
return os;