src: fix canonization by resetting io service after each neighbor
refs: #4872
Change-Id: I87e83eb36f1a17d0dc2633f04c529f71d751a497
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index a468e6c..d3e75be 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -489,6 +489,7 @@
m_io,
TIME_ALLOWED_FOR_CANONIZATION);
m_io.run();
+ m_io.reset();
if (failedToCanonize) {
return false;
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index 4f0d8a7..2d5958d 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -292,6 +292,32 @@
static_cast<uint32_t>(ADJ_LSA_BUILD_INTERVAL_DEFAULT));
}
+BOOST_AUTO_TEST_CASE(CanonizeNeighbors)
+{
+ std::string config = std::string(R"INFO(neighbors
+ {
+ neighbor
+ {
+ name /ndn/edu/arizona/%C1.Router/hobo
+ face-uri udp4://hobo.cs.arizona.edu
+ link-cost 20
+ }
+ neighbor
+ {
+ name /ndn/edu/umich/%C1.Router/ndn0
+ face-uri udp4://michigan.testbed.named-data.net
+ link-cost 30
+ }
+ })INFO");
+
+ BOOST_CHECK_EQUAL(processConfigurationString(config), true);
+
+ BOOST_CHECK_EQUAL(conf.m_adjl.getAdjacent("/ndn/edu/arizona/%C1.Router/hobo").getFaceUri().toString(),
+ "udp4://128.196.203.36:6363");
+ BOOST_CHECK_EQUAL(conf.m_adjl.getAdjacent("/ndn/edu/umich/%C1.Router/ndn0").getFaceUri().toString(),
+ "udp4://198.111.224.197:6363");
+}
+
BOOST_AUTO_TEST_CASE(DefaultValuesFib)
{
std::string config = SECTION_FIB;