src: change initialization order
Send Hello Interest after route to neighbor is successfully registered
--> First Hello interval is eliminated
--> After Hello Nack, wait exponentially before processing it as a timeout
Register sync route for each neighbor after its Hello Data is validated
refs: #5009
Change-Id: Ice39a591f1e58e474b494d93c913fa45e10f24f2
diff --git a/src/main.cpp b/src/main.cpp
index b271298..d109582 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -20,7 +20,7 @@
**/
#include "conf-file-processor.hpp"
-#include "nlsr-runner.hpp"
+#include "nlsr.hpp"
#include "version.hpp"
#include <boost/exception/get_error_info.hpp>
@@ -85,6 +85,7 @@
boost::asio::io_service ioService;
ndn::Face face(ioService);
+ ndn::KeyChain keyChain;
nlsr::ConfParameter confParam(face, configFileName);
nlsr::ConfFileProcessor configProcessor(confParam);
@@ -94,15 +95,16 @@
return 2;
}
- confParam.buildRouterPrefix();
+ confParam.buildRouterAndSyncUserPrefix();
confParam.writeLog();
- nlsr::NlsrRunner runner(face, confParam);
+ nlsr::Nlsr nlsr(face, keyChain, confParam);
try {
- runner.run();
+ face.processEvents();
}
catch (const std::exception& e) {
+ nlsr.getFib().clean();
std::cerr << "FATAL: " << getExtendedErrorMessage(e) << std::endl;
return 1;
}