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) {
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index fca81eb..b0cc156 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -216,7 +216,7 @@
*/
VIRTUAL_WITH_TESTS void
onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry, bool isSatisfied,
- time::milliseconds dataFreshnessPeriod = time::milliseconds(-1));
+ ndn::optional<time::milliseconds> dataFreshnessPeriod = ndn::nullopt);
/** \brief incoming Data pipeline
*/
@@ -249,7 +249,7 @@
VIRTUAL_WITH_TESTS void
setStragglerTimer(const shared_ptr<pit::Entry>& pitEntry, bool isSatisfied,
- time::milliseconds dataFreshnessPeriod = time::milliseconds(-1));
+ ndn::optional<time::milliseconds> dataFreshnessPeriod = ndn::nullopt);
VIRTUAL_WITH_TESTS void
cancelUnsatisfyAndStragglerTimer(pit::Entry& pitEntry);
@@ -260,7 +260,7 @@
*/
VIRTUAL_WITH_TESTS void
insertDeadNonceList(pit::Entry& pitEntry, bool isSatisfied,
- time::milliseconds dataFreshnessPeriod, Face* upstream);
+ ndn::optional<time::milliseconds> dataFreshnessPeriod, Face* upstream);
/** \brief call trigger (method) on the effective strategy of pitEntry
*/