cs+fw: omitted FreshnessPeriod implies always stale
refs #3944
Change-Id: I018242b3ba5850e8a126f956af4150b512406efd
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 41ab2e2..3263b43 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -300,7 +300,7 @@
void
Forwarder::onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry, bool isSatisfied,
- time::milliseconds dataFreshnessPeriod)
+ ndn::optional<time::milliseconds> dataFreshnessPeriod)
{
NFD_LOG_DEBUG("onInterestFinalize interest=" << pitEntry->getName() <<
(isSatisfied ? " satisfied" : " unsatisfied"));
@@ -552,7 +552,7 @@
void
Forwarder::setStragglerTimer(const shared_ptr<pit::Entry>& pitEntry, bool isSatisfied,
- time::milliseconds dataFreshnessPeriod)
+ ndn::optional<time::milliseconds> dataFreshnessPeriod)
{
time::nanoseconds stragglerTime = time::milliseconds(100);
@@ -577,18 +577,15 @@
void
Forwarder::insertDeadNonceList(pit::Entry& pitEntry, bool isSatisfied,
- time::milliseconds dataFreshnessPeriod, Face* upstream)
+ ndn::optional<time::milliseconds> dataFreshnessPeriod, Face* upstream)
{
// need Dead Nonce List insert?
- bool needDnl = false;
+ bool needDnl = true;
if (isSatisfied) {
- bool hasFreshnessPeriod = dataFreshnessPeriod >= time::milliseconds::zero();
- // Data never becomes stale if it doesn't have FreshnessPeriod field
+ BOOST_ASSERT(dataFreshnessPeriod);
+ BOOST_ASSERT(*dataFreshnessPeriod >= time::milliseconds::zero());
needDnl = static_cast<bool>(pitEntry.getInterest().getMustBeFresh()) &&
- (hasFreshnessPeriod && dataFreshnessPeriod < m_deadNonceList.getLifetime());
- }
- else {
- needDnl = true;
+ *dataFreshnessPeriod < m_deadNonceList.getLifetime();
}
if (!needDnl) {