comm: Make SyncLogic responsible for update prefix
refs: #2289
Change-Id: I7687e36c88853bdf58de654b1ca280662a826b4b
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 5e20795..5f87436 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -132,6 +132,20 @@
}
};
+SyncLogicHandler::SyncLogicHandler(ndn::Face& face,
+ Lsdb& lsdb, ConfParameter& conf,
+ SequencingManager& seqManager)
+ : m_validator(new ndn::ValidatorNull())
+ , m_syncFace(face)
+ , m_lsdb(lsdb)
+ , m_confParam(conf)
+ , m_sequencingManager(seqManager)
+{
+ m_updatePrefix = m_confParam.getLsaPrefix();
+ m_updatePrefix.append(m_confParam.getSiteName());
+ m_updatePrefix.append(m_confParam.getRouterName());
+}
+
void
SyncLogicHandler::createSyncSocket()
{
@@ -247,10 +261,11 @@
}
void
-SyncLogicHandler::publishRoutingUpdate(SequencingManager& manager, const ndn::Name& updatePrefix)
+SyncLogicHandler::publishRoutingUpdate()
{
- manager.writeSeqNoToFile();
- publishSyncUpdate(updatePrefix, manager.getCombinedSeqNo());
+ m_sequencingManager.writeSeqNoToFile();
+
+ publishSyncUpdate(m_updatePrefix, m_sequencingManager.getCombinedSeqNo());
}
void
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index 70fd07e..e602037 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -41,13 +41,7 @@
class SyncLogicHandler
{
public:
- SyncLogicHandler(ndn::Face& face, Lsdb& lsdb, ConfParameter& conf)
- : m_validator(new ndn::ValidatorNull())
- , m_syncFace(face)
- , m_lsdb(lsdb)
- , m_confParam(conf)
- {
- }
+ SyncLogicHandler(ndn::Face& face, Lsdb& lsdb, ConfParameter& conf, SequencingManager& seqManager);
void
createSyncSocket();
@@ -59,7 +53,7 @@
onNsyncRemoval(const std::string& prefix);
void
- publishRoutingUpdate(SequencingManager& manager, const ndn::Name& updatePrefix);
+ publishRoutingUpdate();
void
setSyncPrefix(const std::string& sp)
@@ -89,6 +83,9 @@
Lsdb& m_lsdb;
ConfParameter& m_confParam;
+ const SequencingManager& m_sequencingManager;
+
+ ndn::Name m_updatePrefix;
static const std::string NLSR_COMPONENT;
static const std::string LSA_COMPONENT;