Hard-code fixed session name for ChronoSync sockets
This commit reverts behavior of the hard-coded fixed session name that
was feature in old nsync-based implementation.
Also fixing an initialized configuration parameter.
refs: #4513
Change-Id: I44559e729c949f90511a5c53282fd4a240356157
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 6257be5..5226ed4 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -71,20 +71,21 @@
// of the object
std::shared_ptr<ndn::Face> facePtr(&m_syncFace, NullDeleter<ndn::Face>());
+ const auto fixedSession = ndn::name::Component::fromNumber(0);
m_syncSocket = std::make_shared<chronosync::Socket>(m_syncPrefix, m_nameLsaUserPrefix, *facePtr,
std::bind(&SyncLogicHandler::onChronoSyncUpdate, this, _1),
chronosync::Socket::DEFAULT_NAME, chronosync::Socket::DEFAULT_VALIDATOR,
- syncInterestLifetime);
+ syncInterestLifetime, fixedSession);
if (m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_OFF) {
- m_syncSocket->addSyncNode(m_adjLsaUserPrefix);
+ m_syncSocket->addSyncNode(m_adjLsaUserPrefix, chronosync::Socket::DEFAULT_NAME, fixedSession);
}
else if (m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_ON) {
- m_syncSocket->addSyncNode(m_coorLsaUserPrefix);
+ m_syncSocket->addSyncNode(m_coorLsaUserPrefix, chronosync::Socket::DEFAULT_NAME, fixedSession);
}
else {
- m_syncSocket->addSyncNode(m_adjLsaUserPrefix);
- m_syncSocket->addSyncNode(m_coorLsaUserPrefix);
+ m_syncSocket->addSyncNode(m_adjLsaUserPrefix, chronosync::Socket::DEFAULT_NAME, fixedSession);
+ m_syncSocket->addSyncNode(m_coorLsaUserPrefix, chronosync::Socket::DEFAULT_NAME, fixedSession);
}
}
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index 549d353..8c0e1a9 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -143,6 +143,7 @@
, m_hyperbolicState(HYPERBOLIC_STATE_OFF)
, m_corR(0)
, m_maxFacesPerPrefix(MAX_FACES_PER_PREFIX_MIN)
+ , m_syncInterestLifetime(ndn::time::milliseconds(SYNC_INTEREST_LIFETIME_DEFAULT))
{
}
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 2a78171..0709e43 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2017, The University of Memphis,
+ * Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -53,10 +53,6 @@
// Initialize NLSR so a sync socket is created
nlsr.initialize();
- // Saving clock::now before any advanceClocks so that it will
- // be the same value as what ChronoSync uses in setting the sessionName
- sessionTime.appendNumber(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count());
-
this->advanceClocks(ndn::time::milliseconds(10), 10);
face.sentInterests.clear();
@@ -80,8 +76,6 @@
ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA/This/router");
lsaInterestName.append(std::to_string(Lsa::Type::NAME));
- // The part after LSA is Chronosync getSession
- lsaInterestName.append(sessionTime);
lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
shared_ptr<ndn::Interest> lsaInterest = make_shared<ndn::Interest>(lsaInterestName);
@@ -110,7 +104,6 @@
Nlsr nlsr;
NamePrefixList& namePrefixes;
NfdRibCommandProcessor& processor;
- ndn::Name sessionTime;
uint64_t nameLsaSeqNoBeforeInterest;
};
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 4fdf19b..c4bbaa7 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -125,10 +125,6 @@
// Initialize NLSR so a sync socket is created
nlsr.initialize();
- // Saving clock::now before any advanceClocks so that it will
- // be the same value as what ChronoSync uses in setting the sessionName
- sessionTime.appendNumber(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count());
-
this->advanceClocks(ndn::time::milliseconds(10));
face.sentInterests.clear();
@@ -144,8 +140,6 @@
lsaInterestName.append(nlsr.getConfParameter().getRouterName());
lsaInterestName.append(std::to_string(Lsa::Type::NAME));
- // The part after LSA is Chronosync getSession
- lsaInterestName.append(sessionTime);
lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
std::shared_ptr<Interest> lsaInterest = std::make_shared<Interest>(lsaInterestName);
@@ -184,7 +178,6 @@
PrefixUpdateProcessor& updatePrefixUpdateProcessor;
const boost::filesystem::path SITE_CERT_PATH;
- ndn::Name sessionTime;
};
BOOST_FIXTURE_TEST_SUITE(TestPrefixUpdateProcessor, PrefixUpdateFixture)