src: fix incorrect error on face-dataset-fetch-interval valid values
refs: #4211
Change-Id: I9ec04483a633ecf31797dd1637229d147d436d35
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index 5362a41..9facbd5 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -19,6 +19,12 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+#include "conf-parameter.hpp"
+#include "conf-file-processor.hpp"
+#include "adjacent.hpp"
+#include "utility/name-helper.hpp"
+#include "update/prefix-update-processor.hpp"
+
#include <iostream>
#include <fstream>
@@ -31,12 +37,6 @@
#include <boost/property_tree/ptree.hpp>
#include <boost/filesystem.hpp>
-#include "conf-parameter.hpp"
-#include "conf-file-processor.hpp"
-#include "adjacent.hpp"
-#include "utility/name-helper.hpp"
-#include "update/prefix-update-processor.hpp"
-
namespace nlsr {
using namespace std;
@@ -469,14 +469,14 @@
}
// Set the interval between FaceStatus dataset fetch attempts.
- ConfigurationVariable<ndn::time::seconds> faceDatasetFetchInterval("face-dataset-fetch-interval",
+ ConfigurationVariable<uint32_t> faceDatasetFetchInterval("face-dataset-fetch-interval",
bind(&ConfParameter::setFaceDatasetFetchInterval,
&m_nlsr.getConfParameter(),
_1));
- faceDatasetFetchInterval.setMinAndMaxValue(ndn::time::seconds(FACE_DATASET_FETCH_INTERVAL_MIN),
- ndn::time::seconds(FACE_DATASET_FETCH_INTERVAL_MAX));
- faceDatasetFetchInterval.setOptional(ndn::time::seconds(FACE_DATASET_FETCH_INTERVAL_DEFAULT));
+ faceDatasetFetchInterval.setMinAndMaxValue(FACE_DATASET_FETCH_INTERVAL_MIN,
+ FACE_DATASET_FETCH_INTERVAL_MAX);
+ faceDatasetFetchInterval.setOptional(FACE_DATASET_FETCH_INTERVAL_DEFAULT);
if (!faceDatasetFetchInterval.parseFromConfigSection(section)) {
return false;
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index 6ec21f5..e21e547 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -22,14 +22,14 @@
#ifndef NLSR_CONF_PARAMETER_HPP
#define NLSR_CONF_PARAMETER_HPP
+#include "logger.hpp"
+
#include <iostream>
#include <boost/cstdint.hpp>
#include <ndn-cxx/common.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/time.hpp>
-#include "logger.hpp"
-
namespace nlsr {
enum {
@@ -115,6 +115,7 @@
, m_adjLsaBuildInterval(ADJ_LSA_BUILD_INTERVAL_DEFAULT)
, m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT)
, m_routingCalcInterval(ROUTING_CALC_INTERVAL_DEFAULT)
+ , m_faceDatasetFetchInterval(ndn::time::seconds(static_cast<int>(FACE_DATASET_FETCH_INTERVAL_DEFAULT)))
, m_lsaInterestLifetime(ndn::time::seconds(static_cast<int>(LSA_INTEREST_LIFETIME_DEFAULT)))
, m_routerDeadInterval(2 * LSA_REFRESH_TIME_DEFAULT)
, m_logLevel("INFO")
@@ -286,9 +287,9 @@
}
void
- setFaceDatasetFetchInterval(ndn::time::seconds interval)
+ setFaceDatasetFetchInterval(uint32_t interval)
{
- m_faceDatasetFetchInterval = interval;
+ m_faceDatasetFetchInterval = ndn::time::seconds(interval);
}
const ndn::time::seconds
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 2cfe46f..cba776b 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -19,11 +19,10 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+#include "nlsr.hpp"
#include "test-common.hpp"
#include "control-commands.hpp"
-#include "nlsr.hpp"
-
#include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
namespace nlsr {
@@ -660,7 +659,7 @@
ndn::nfd::CommandOptions options;
ndn::time::milliseconds defaultTimeout = options.getTimeout();
- ndn::time::seconds fetchInterval(1);
+ int fetchInterval(1);
ConfParameter& conf = nlsr.getConfParameter();
conf.setFaceDatasetFetchInterval(fetchInterval);
conf.setFaceDatasetFetchTries(0);
@@ -680,7 +679,7 @@
BOOST_CHECK_EQUAL(nNameMatches, 1);
// Elapse the clock by the reschedule time (that we set)
- this->advanceClocks(fetchInterval);
+ this->advanceClocks(ndn::time::seconds(fetchInterval));
// Elapse the default timeout on the interest.
this->advanceClocks(defaultTimeout);
// Plus a little more to let the events process.