Add ASF measurement lifetime as strategy parameter
Refs: #5332
Change-Id: Iff42ca0870d4263f0ad8757a67b87e52dbfff9f5
diff --git a/daemon/fw/asf-measurements.hpp b/daemon/fw/asf-measurements.hpp
index 75a3c2b..77925b6 100644
--- a/daemon/fw/asf-measurements.hpp
+++ b/daemon/fw/asf-measurements.hpp
@@ -132,8 +132,9 @@
}
explicit
- NamespaceInfo(shared_ptr<const ndn::util::RttEstimator::Options> opts)
+ NamespaceInfo(shared_ptr<const ndn::util::RttEstimator::Options> opts, time::milliseconds measurementLifetime)
: m_rttEstimatorOpts(std::move(opts))
+ , m_measurementLifetime(measurementLifetime)
{
}
@@ -173,6 +174,7 @@
private:
std::unordered_map<FaceId, FaceInfo> m_fiMap;
shared_ptr<const ndn::util::RttEstimator::Options> m_rttEstimatorOpts;
+ time::milliseconds m_measurementLifetime;
bool m_isProbingDue = false;
bool m_isFirstProbeScheduled = false;
};
@@ -201,14 +203,29 @@
NamespaceInfo&
getOrCreateNamespaceInfo(const fib::Entry& fibEntry, const Name& prefix);
+ void
+ setMeasurementsLifetime(time::milliseconds measurementsLifetime)
+ {
+ // Measurement lifetime should not expire as soon as it is configured
+ BOOST_ASSERT(measurementsLifetime > 0_ms);
+ m_measurementsLifetime = measurementsLifetime;
+ }
+
+ time::milliseconds
+ getMeasurementsLifetime() const
+ {
+ return m_measurementsLifetime;
+ }
+
private:
void
extendLifetime(measurements::Entry& me);
public:
- static constexpr time::microseconds MEASUREMENTS_LIFETIME = 5_min;
+ static constexpr time::milliseconds DEFAULT_MEASUREMENTS_LIFETIME = 5_min;
private:
+ time::milliseconds m_measurementsLifetime = DEFAULT_MEASUREMENTS_LIFETIME;
MeasurementsAccessor& m_measurements;
shared_ptr<const ndn::util::RttEstimator::Options> m_rttEstimatorOpts;
};