conf: Add `general.router-dead-interval` configuration setting
refs: #1878
Change-Id: I21f2837118cda424904e0b0e60708a12deeabc8e
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index bf07bee..3728a09 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -271,6 +271,23 @@
}
try {
+ int32_t routerDeadInterval = section.get<int32_t>("router-dead-interval");
+
+ if (routerDeadInterval > m_nlsr.getConfParameter().getLsaRefreshTime()) {
+ m_nlsr.getConfParameter().setRouterDeadInterval(routerDeadInterval);
+ }
+ else {
+ std::cerr << "Value of router-dead-interval must be larger than lsa-refresh-time"
+ << std::endl;
+ return false;
+ }
+ }
+ catch (const std::exception& ex) {
+ std::cerr << ex.what() << std::endl;
+ // non-critical error. default value is 2 * lsa-refresh-time
+ }
+
+ try {
int lifetime = section.get<int>("lsa-interest-lifetime");
if (lifetime >= LSA_INTEREST_LIFETIME_MIN && lifetime <= LSA_INTEREST_LIFETIME_MAX) {
m_nlsr.getConfParameter().setLsaInterestLifetime(ndn::time::seconds(lifetime));
@@ -284,7 +301,7 @@
}
catch (const std::exception& ex) {
std::cerr << ex.what() << std::endl;
- // return false;
+ // non-critical error. default value is 4
}
try {
diff --git a/src/conf-parameter.cpp b/src/conf-parameter.cpp
index f2b8bd2..763d771 100644
--- a/src/conf-parameter.cpp
+++ b/src/conf-parameter.cpp
@@ -41,6 +41,7 @@
_LOG_DEBUG("Info Interest interval: " << m_infoInterestInterval);
_LOG_DEBUG("LSA refresh time: " << m_lsaRefreshTime);
_LOG_DEBUG("LSA Interest lifetime: " << getLsaInterestLifetime());
+ _LOG_DEBUG("Router dead interval: " << getRouterDeadInterval());
_LOG_DEBUG("Max Faces Per Prefix: " << m_maxFacesPerPrefix);
_LOG_DEBUG("Hyperbolic Routing: " << m_hyperbolicState);
_LOG_DEBUG("Hyp R: " << m_corR);
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index 6f51d70..02eee7b 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -102,7 +102,7 @@
, m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT)
, m_routingCalcInterval(ROUTING_CALC_INTERVAL_DEFAULT)
, m_lsaInterestLifetime(ndn::time::seconds(static_cast<int>(LSA_INTEREST_LIFETIME_DEFAULT)))
- , m_routerDeadInterval(2*LSA_REFRESH_TIME_DEFAULT)
+ , m_routerDeadInterval(2 * LSA_REFRESH_TIME_DEFAULT)
, m_logLevel("INFO")
, m_interestRetryNumber(HELLO_RETRIES_DEFAULT)
, m_interestResendTime(HELLO_TIMEOUT_DEFAULT)