-
-
Save agawande/d9a6f3cc1245c133bb48c8ac58353579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/socket.cpp b/src/socket.cpp | |
index 4d46d7f..a3f3078 100644 | |
--- a/src/socket.cpp | |
+++ b/src/socket.cpp | |
@@ -100,21 +100,22 @@ Socket::removeSyncNode(const Name& prefix) | |
} | |
void | |
-Socket::publishData(const uint8_t* buf, size_t len, const ndn::time::milliseconds& freshness, | |
+Socket::publishData(const uint8_t* buf, size_t len, const ndn::time::milliseconds& freshness, uint64_t seqNo, | |
const Name& prefix) | |
{ | |
- publishData(ndn::encoding::makeBinaryBlock(ndn::tlv::Content, buf, len), freshness, prefix); | |
+ publishData(ndn::encoding::makeBinaryBlock(ndn::tlv::Content, buf, len), freshness, seqNo, prefix); | |
} | |
void | |
-Socket::publishData(const Block& content, const ndn::time::milliseconds& freshness, | |
+Socket::publishData(const Block& content, const ndn::time::milliseconds& freshness, uint64_t seqNo, | |
const Name& prefix) | |
{ | |
shared_ptr<Data> data = make_shared<Data>(); | |
data->setContent(content); | |
data->setFreshnessPeriod(freshness); | |
- SeqNo newSeq = m_logic.getSeqNo(prefix) + 1; | |
+ //SeqNo newSeq = m_logic.getSeqNo(prefix) + 1; | |
+ SeqNo newSeq = seqNo; | |
Name dataName; | |
dataName.append(m_logic.getSessionName(prefix)).appendNumber(newSeq); | |
data->setName(dataName); | |
diff --git a/src/socket.hpp b/src/socket.hpp | |
index d213018..6422754 100644 | |
--- a/src/socket.hpp | |
+++ b/src/socket.hpp | |
@@ -107,7 +107,7 @@ public: | |
* @param freshness FreshnessPeriod of the data packet. | |
*/ | |
void | |
- publishData(const uint8_t* buf, size_t len, const ndn::time::milliseconds& freshness, | |
+ publishData(const uint8_t* buf, size_t len, const ndn::time::milliseconds& freshness, uint64_t seqNo, | |
const Name& prefix = DEFAULT_PREFIX); | |
/** | |
@@ -123,7 +123,7 @@ public: | |
* @param freshness FreshnessPeriod of the data packet. | |
*/ | |
void | |
- publishData(const Block& content, const ndn::time::milliseconds& freshness, | |
+ publishData(const Block& content, const ndn::time::milliseconds& freshness, uint64_t seqNo, | |
const Name& prefix = DEFAULT_PREFIX); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ndn/experiments/convergence_experiment.py b/ndn/experiments/convergence_experiment.py | |
index c67b184..9208641 100644 | |
--- a/ndn/experiments/convergence_experiment.py | |
+++ b/ndn/experiments/convergence_experiment.py | |
@@ -32,6 +32,9 @@ class ConvergenceExperiment(Experiment): | |
self.checkConvergence() | |
def run(self): | |
- pass | |
+ for host in self.net.hosts: | |
+ if host.name == "a": | |
+ for i in range(500): | |
+ host.cmd("nlsrc advertise /prefix/%s" % str(i)) | |
Can use: | |
sudo minindn --experiment convergence | |
to reproduce "ERROR: Interest size exceeds maximum limit" for exclude interest (if you can't run a big topology) | |
I was not able to get Chronosync logs to work by export NDN_EXPORT=*=DEBUG before NLSR runs on each node. | |
So I replaced Chronosync logs with couts and directed all output of NLSR to a file here: | |
https://github.com/named-data/mini-ndn/blob/master/ndn/nlsr.py#L50. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp | |
index 7c00d37..7d706d3 100644 | |
--- a/src/communication/sync-logic-handler.cpp | |
+++ b/src/communication/sync-logic-handler.cpp | |
@@ -156,22 +156,38 @@ SyncLogicHandler::createSyncSocket(const ndn::Name& syncPrefix) | |
// of the object | |
ndn::shared_ptr<ndn::Face> facePtr(&m_syncFace, NullDeleter<ndn::Face>()); | |
- m_syncSocket = ndn::make_shared<Sync::SyncSocket>(m_syncPrefix, m_validator, facePtr, | |
+ m_syncSocket = make_shared<chronosync::Socket>(const_cast<const Name&>(m_syncPrefix), | |
+ const_cast<const Name&>(m_updatePrefix), | |
+ ref(*facePtr), | |
+ bind(&SyncLogicHandler::onNsyncUpdate, this, _1), | |
+ chronosync::Socket::DEFAULT_NAME, | |
+ m_validator); | |
} | |
void | |
-SyncLogicHandler::onNsyncUpdate(const vector<Sync::MissingDataInfo>& v, Sync::SyncSocket* socket) | |
+SyncLogicHandler::onNsyncUpdate(const vector<chronosync::MissingDataInfo>& v) | |
{ | |
_LOG_DEBUG("Received Nsync update event"); | |
for (size_t i = 0; i < v.size(); i++){ | |
- _LOG_DEBUG("Update Name: " << v[i].prefix << " Seq no: " << v[i].high.getSeq()); | |
+ _LOG_DEBUG("Update Name: " << v[i].session.getPrefix(-1).toUri() << " Seq no: " << v[i].high); | |
- SyncUpdate update(v[i].prefix, v[i].high.getSeq()); | |
+ SyncUpdate update(v[i].session.getPrefix(-1), v[i].high); | |
processUpdateFromSync(update); | |
} | |
@@ -262,6 +278,8 @@ void | |
SyncLogicHandler::expressInterestForLsa(const SyncUpdate& update, std::string lsaType, | |
uint64_t seqNo) | |
{ | |
+ //ndn::Name interest(update.getName()); | |
+ _LOG_DEBUG("Expressing interest for: " << update.getName()); | |
ndn::Name interest(update.getName()); | |
interest.append(lsaType); | |
interest.appendNumber(seqNo); | |
@@ -272,12 +290,12 @@ SyncLogicHandler::expressInterestForLsa(const SyncUpdate& update, std::string ls | |
void | |
SyncLogicHandler::publishRoutingUpdate() | |
{ | |
+ _LOG_TRACE("Publishing Routing Update: " << m_updatePrefix); | |
if (m_syncSocket == nullptr) { | |
_LOG_FATAL("Cannot publish routing update; SyncSocket does not exist"); | |
throw SyncLogicHandler::Error("Cannot publish routing update; SyncSocket does not exist"); | |
} | |
- | |
m_sequencingManager.writeSeqNoToFile(); | |
publishSyncUpdate(m_updatePrefix, m_sequencingManager.getCombinedSeqNo()); | |
@@ -297,9 +315,23 @@ SyncLogicHandler::publishSyncUpdate(const ndn::Name& updatePrefix, uint64_t seqN | |
_LOG_DEBUG("Publishing Sync Update. Prefix: " << updatePrefix << " Seq No: " << seqNo); | |
ndn::Name updateName(updatePrefix); | |
+ | |
+ //static const std::string content = "NoData"; | |
string data("NoData"); | |
- m_syncSocket->publishData(updateName.toUri(), 0, data.c_str(), data.size(), 1000, seqNo); | |
+ _LOG_DEBUG("Data: " << (const uint8_t*)data.c_str()); | |
+ m_syncSocket->publishData((const uint8_t*)data.c_str(), data.size(), ndn::time::milliseconds(1000), seqNo, updateName); | |
} | |
} // namespace nlsr | |
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp | |
index 955a9c1..42b1afc 100644 | |
--- a/src/communication/sync-logic-handler.hpp | |
+++ b/src/communication/sync-logic-handler.hpp | |
@@ -24,7 +24,8 @@ | |
#include <ndn-cxx/face.hpp> | |
#include <ndn-cxx/security/validator-null.hpp> | |
-#include <nsync/sync-socket.h> | |
+//#include <nsync/sync-socket.h> | |
+#include <ChronoSync/socket.hpp> | |
#include <iostream> | |
#include <unistd.h> | |
@@ -62,7 +63,8 @@ public: | |
\param socket The socket that Sync is using to synchronize updates. | |
*/ | |
void | |
- onNsyncUpdate(const std::vector<Sync::MissingDataInfo>& v, Sync::SyncSocket* socket); | |
+ onNsyncUpdate(const std::vector<chronosync::MissingDataInfo>& v); | |
void | |
onNsyncRemoval(const std::string& prefix); | |
@@ -92,7 +94,7 @@ private: | |
private: | |
ndn::shared_ptr<ndn::ValidatorNull> m_validator; | |
ndn::Face& m_syncFace; | |
- ndn::shared_ptr<Sync::SyncSocket> m_syncSocket; | |
+ std::shared_ptr<chronosync::Socket> m_syncSocket; | |
ndn::Name m_syncPrefix; | |
private: | |
diff --git a/wscript b/wscript | |
index dbdb5a6..3956f13 100644 | |
--- a/wscript | |
+++ b/wscript | |
@@ -33,8 +33,7 @@ import os | |
def options(opt): | |
opt.load(['compiler_cxx', 'gnu_dirs']) | |
opt.load(['default-compiler-flags', 'coverage', | |
- 'boost', 'protoc', 'openssl', | |
- 'doxygen', 'sphinx_build'], | |
+ 'boost', 'doxygen', 'sphinx_build'], | |
tooldir=['.waf-tools']) | |
nlsropt = opt.add_option_group('NLSR Options') | |
@@ -45,8 +44,7 @@ def options(opt): | |
def configure(conf): | |
conf.load(['compiler_cxx', 'gnu_dirs', | |
- 'boost', 'openssl', | |
- 'default-compiler-flags', | |
+ 'boost', 'default-compiler-flags', | |
'doxygen', 'sphinx_build']) | |
if 'PKG_CONFIG_PATH' not in os.environ: | |
@@ -58,7 +56,7 @@ def configure(conf): | |
conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], | |
uselib_store='LOG4CXX', mandatory=True) | |
- conf.check_openssl(mandatory=True) | |
+ #conf.check_openssl(mandatory=True) | |
boost_libs = 'system chrono program_options iostreams thread regex filesystem' | |
if conf.options.with_tests: | |
@@ -73,7 +71,10 @@ def configure(conf): | |
Logs.error("Please upgrade your distribution or install custom boost libraries") | |
return | |
- conf.load('protoc') | |
+ conf.check_cfg (package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'], | |
+ uselib_store='SYNC', mandatory=True) | |
+ | |
+ #conf.load('protoc') | |
conf.load('coverage') | |
@@ -100,23 +101,13 @@ def build(bld): | |
VERSION_PATCH=VERSION_SPLIT[2], | |
) | |
- nsync_objects = bld( | |
- target='nsync-objects', | |
- name='nsync-objects', | |
- features='cxx', | |
- source=bld.path.ant_glob(['nsync/**/*.cc', 'nsync/**/*.proto']), | |
- use='BOOST NDN_CXX OPENSSL LOG4CXX', | |
- includes='nsync', | |
- export_includes='nsync', | |
- ) | |
- | |
nlsr_objects = bld( | |
target='nlsr-objects', | |
name='nlsr-objects', | |
features='cxx', | |
source=bld.path.ant_glob(['src/**/*.cpp'], | |
excl=['src/main.cpp']), | |
- use='nsync-objects NDN_CXX BOOST LOG4CXX', | |
+ use='NDN_CXX BOOST LOG4CXX SYNC', | |
includes='. src', | |
export_includes='. src', | |
) | |
@@ -125,14 +116,14 @@ def build(bld): | |
target='bin/nlsr', | |
features='cxx cxxprogram', | |
source='src/main.cpp', | |
- use='nlsr-objects', | |
+ use='nlsr-objects SYNC', | |
) | |
nlsrc = bld( | |
target='bin/nlsrc', | |
features='cxx cxxprogram', | |
source='tools/nlsrc.cpp', | |
- use='nlsr-objects BOOST', | |
+ use='nlsr-objects BOOST SYNC', | |
) | |
if bld.env['WITH_TESTS']: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment