publisher: set router-name command prefix correctly
refs: #3651
Change-Id: Ic3771de5161fc482f76df78035dcb9f5325e1a9d
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 2409956..a6039e4 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -60,7 +60,6 @@
, m_helloProtocol(*this, scheduler)
, m_lsdbDatasetHandler(m_nlsrLsdb,
m_nlsrFace,
- m_confParam.getRouterPrefix(),
m_keyChain)
, m_certificateCache(new ndn::CertificateCacheTtl(ioService))
, m_validator(m_nlsrFace, DEFAULT_BROADCAST_PREFIX, m_certificateCache, m_certStore)
@@ -179,6 +178,7 @@
{
_LOG_DEBUG("Initializing Nlsr");
m_confParam.buildRouterPrefix();
+ m_lsdbDatasetHandler.setRouterNameCommandPrefix(m_confParam.getRouterPrefix());
m_nlsrLsdb.setLsaRefreshTime(ndn::time::seconds(m_confParam.getLsaRefreshTime()));
m_nlsrLsdb.setThisRouterPrefix(m_confParam.getRouterPrefix().toUri());
m_fib.setEntryRefreshTime(2 * m_confParam.getLsaRefreshTime());
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 3f9fa24..4e9cc23 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -226,6 +226,12 @@
return m_syncLogicHandler;
}
+ LsdbDatasetInterestHandler&
+ getLsdbDatasetHandler()
+ {
+ return m_lsdbDatasetHandler;
+ }
+
void
initialize();
diff --git a/src/publisher/lsdb-dataset-interest-handler.cpp b/src/publisher/lsdb-dataset-interest-handler.cpp
index 11ddc69..4ea6454 100644
--- a/src/publisher/lsdb-dataset-interest-handler.cpp
+++ b/src/publisher/lsdb-dataset-interest-handler.cpp
@@ -37,10 +37,8 @@
LsdbDatasetInterestHandler::LsdbDatasetInterestHandler(Lsdb& lsdb,
ndn::Face& face,
- const ndn::Name& routerName,
ndn::KeyChain& keyChain)
: LOCALHOST_COMMAND_PREFIX(ndn::Name(Nlsr::LOCALHOST_PREFIX).append(Lsdb::NAME_COMPONENT))
- , ROUTER_NAME_COMMAND_PREFIX(ndn::Name(routerName).append(Lsdb::NAME_COMPONENT))
, m_face(face)
, m_keyChain(keyChain)
, m_adjacencyLsaPublisher(lsdb, face, keyChain)
@@ -66,10 +64,10 @@
void
LsdbDatasetInterestHandler::startListeningOnRouterPrefix()
{
- _LOG_DEBUG("Setting interest filter for: " << ROUTER_NAME_COMMAND_PREFIX);
- m_face.setInterestFilter(ROUTER_NAME_COMMAND_PREFIX,
+ _LOG_DEBUG("Setting interest filter for: " << m_routerNameCommandPrefix);
+ m_face.setInterestFilter(m_routerNameCommandPrefix,
std::bind(&LsdbDatasetInterestHandler::onInterest, this, _2,
- std::cref(ROUTER_NAME_COMMAND_PREFIX)));
+ std::cref(m_routerNameCommandPrefix)));
}
void
diff --git a/src/publisher/lsdb-dataset-interest-handler.hpp b/src/publisher/lsdb-dataset-interest-handler.hpp
index c56c638..4285803 100644
--- a/src/publisher/lsdb-dataset-interest-handler.hpp
+++ b/src/publisher/lsdb-dataset-interest-handler.hpp
@@ -48,7 +48,6 @@
LsdbDatasetInterestHandler(Lsdb& lsdb,
ndn::Face& face,
- const ndn::Name& routerName,
ndn::KeyChain& keyChain);
void
@@ -63,10 +62,16 @@
return LOCALHOST_COMMAND_PREFIX;
}
- const ndn::Name&
+ ndn::Name&
getRouterNameCommandPrefix()
{
- return ROUTER_NAME_COMMAND_PREFIX;
+ return m_routerNameCommandPrefix;
+ }
+
+ void
+ setRouterNameCommandPrefix(const ndn::Name& routerName) {
+ m_routerNameCommandPrefix = routerName;
+ m_routerNameCommandPrefix.append(Lsdb::NAME_COMPONENT);
}
private:
@@ -84,7 +89,7 @@
private:
const ndn::Name LOCALHOST_COMMAND_PREFIX;
- const ndn::Name ROUTER_NAME_COMMAND_PREFIX;
+ ndn::Name m_routerNameCommandPrefix;
ndn::Face& m_face;
ndn::KeyChain& m_keyChain;