src: Setting neighbour router's FIB entry expiration to milliseconds::max()
Refs: #1786
Change-Id: I6d51338f9ceb358bb67cdb38feb148780f2f1577
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index 05d121b..41df359 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -65,7 +65,7 @@
}
else {
registerPrefixes((*it).getName(), (*it).getConnectingFaceUri(),
- (*it).getLinkCost(), 31536000);
+ (*it).getLinkCost(), ndn::time::milliseconds::max());
}
}
scheduleInterest(m_nlsr.getConfParameter().getInfoInterestInterval());
@@ -113,7 +113,7 @@
}
else {
registerPrefixes(adjacent->getName(), adjacent->getConnectingFaceUri(),
- adjacent->getLinkCost(), 31536000);
+ adjacent->getLinkCost(), ndn::time::milliseconds::max());
}
}
}
@@ -208,7 +208,7 @@
void
HelloProtocol::registerPrefixes(const ndn::Name& adjName, const std::string& faceUri,
- double linkCost, uint64_t timeout)
+ double linkCost, const ndn::time::milliseconds& timeout)
{
ndn::Name broadcastKeyPrefix = DEFAULT_BROADCAST_PREFIX;
broadcastKeyPrefix.append("KEYS");
diff --git a/src/hello-protocol.hpp b/src/hello-protocol.hpp
index 9c6e223..063e6a8 100644
--- a/src/hello-protocol.hpp
+++ b/src/hello-protocol.hpp
@@ -76,7 +76,7 @@
void
registerPrefixes(const ndn::Name& adjName, const std::string& faceUri,
- double linkCost, uint64_t timeout);
+ double linkCost, const ndn::time::milliseconds& timeout);
private:
Nlsr& m_nlsr;
static const std::string INFO_COMPONENT;
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 2f7914a..3cf0b3c 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -82,7 +82,8 @@
// add entry to NDN-FIB
if (isPrefixUpdatable(it->getName())) {
registerPrefix(it->getName(), nhit->getConnectingFaceUri(),
- std::ceil(nhit->getRouteCost()), (m_refreshTime + GRACE_PERIOD));
+ std::ceil(nhit->getRouteCost()),
+ ndn::time::seconds(m_refreshTime + GRACE_PERIOD));
}
}
// increase sequence number and schedule refresh again
@@ -137,7 +138,8 @@
//Add entry to NDN-FIB
if (isPrefixUpdatable(name)) {
registerPrefix(name, nhit->getConnectingFaceUri(),
- std::ceil(nhit->getRouteCost()), (m_refreshTime + GRACE_PERIOD));
+ std::ceil(nhit->getRouteCost()),
+ ndn::time::seconds(m_refreshTime + GRACE_PERIOD));
}
}
newEntry.getNexthopList().sort();
@@ -160,7 +162,8 @@
// Add first Entry to NDN-FIB
if (isPrefixUpdatable(name)) {
registerPrefix(name, nhit->getConnectingFaceUri(),
- std::ceil(nhit->getRouteCost()), (m_refreshTime + GRACE_PERIOD));
+ std::ceil(nhit->getRouteCost()),
+ ndn::time::seconds(m_refreshTime + GRACE_PERIOD));
}
removeHop(it->getNexthopList(), nhit->getConnectingFaceUri(), name);
it->getNexthopList().reset();
@@ -172,7 +175,8 @@
//Add Entry to NDN_FIB
if (isPrefixUpdatable(name)) {
registerPrefix(name, nhit->getConnectingFaceUri(),
- std::ceil(nhit->getRouteCost()), (m_refreshTime + GRACE_PERIOD));
+ std::ceil(nhit->getRouteCost()),
+ ndn::time::seconds(m_refreshTime + GRACE_PERIOD));
}
}
}
@@ -288,7 +292,7 @@
void
Fib::registerPrefix(const ndn::Name& namePrefix, const std::string& faceUri,
- uint64_t faceCost, uint64_t timeout)
+ uint64_t faceCost, const ndn::time::milliseconds& timeout)
{
createFace(faceUri,
ndn::bind(&Fib::registerPrefixInNfd, this,_1, namePrefix, faceCost, timeout),
@@ -298,7 +302,8 @@
void
Fib::registerPrefix(const ndn::Name& namePrefix,
const std::string& faceUri,
- uint64_t faceCost, uint64_t timeout,
+ uint64_t faceCost,
+ const ndn::time::milliseconds& timeout,
const CommandSucceedCallback& onSuccess,
const CommandFailCallback& onFailure)
@@ -311,14 +316,15 @@
void
Fib::registerPrefixInNfd(const ndn::nfd::ControlParameters& faceCreateResult,
- const ndn::Name& namePrefix, uint64_t faceCost, uint64_t timeout)
+ const ndn::Name& namePrefix, uint64_t faceCost,
+ const ndn::time::milliseconds& timeout)
{
ndn::nfd::ControlParameters controlParameters;
controlParameters
.setName(namePrefix)
.setFaceId(faceCreateResult.getFaceId())
.setCost(faceCost)
- .setExpirationPeriod(ndn::time::milliseconds(timeout * 1000))
+ .setExpirationPeriod(timeout)
.setOrigin(128);
m_controller.start<ndn::nfd::RibRegisterCommand>(controlParameters,
ndn::bind(&Fib::onRegistration, this, _1,
@@ -330,7 +336,8 @@
void
Fib::registerPrefixInNfd(const ndn::nfd::ControlParameters& faceCreateResult,
- const ndn::Name& namePrefix, uint64_t faceCost, uint64_t timeout,
+ const ndn::Name& namePrefix, uint64_t faceCost,
+ const ndn::time::milliseconds& timeout,
const CommandSucceedCallback& onSuccess,
const CommandFailCallback& onFailure)
{
@@ -339,7 +346,7 @@
.setName(namePrefix)
.setFaceId(faceCreateResult.getFaceId())
.setCost(faceCost)
- .setExpirationPeriod(ndn::time::milliseconds(timeout * 1000))
+ .setExpirationPeriod(timeout)
.setOrigin(128);
m_controller.start<ndn::nfd::RibRegisterCommand>(controlParameters,
onSuccess,
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index 6a23772..5121535 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -93,12 +93,14 @@
public:
void
registerPrefix(const ndn::Name& namePrefix, const std::string& faceUri,
- uint64_t faceCost, uint64_t timeout);
+ uint64_t faceCost,
+ const ndn::time::milliseconds& timeout);
void
registerPrefix(const ndn::Name& namePrefix,
const std::string& faceUri,
- uint64_t faceCost, uint64_t timeout,
+ uint64_t faceCost,
+ const ndn::time::milliseconds& timeout,
const CommandSucceedCallback& onSuccess,
const CommandFailCallback& onFailure);
@@ -121,11 +123,13 @@
void
registerPrefixInNfd(const ndn::nfd::ControlParameters& faceCreateResult,
- const ndn::Name& namePrefix, uint64_t faceCost, uint64_t timeout);
+ const ndn::Name& namePrefix, uint64_t faceCost,
+ const ndn::time::milliseconds& timeout);
void
registerPrefixInNfd(const ndn::nfd::ControlParameters& faceCreateResult,
- const ndn::Name& namePrefix, uint64_t faceCost, uint64_t timeout,
+ const ndn::Name& namePrefix, uint64_t faceCost,
+ const ndn::time::milliseconds& timeout,
const CommandSucceedCallback& onSuccess,
const CommandFailCallback& onFailure);