nlsr: Added a finally() to canonizeNeighborUris
Change-Id: I0046ae7a07be69f20a8f9d2b4acb33d8533a28e7
refs: #4128
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 502d5f6..0159cf4 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -436,15 +436,19 @@
neighbors.insert(neighborB);
int nCanonizationsLeft = nlsr.getAdjacencyList().getAdjList().size();
+ std::function<void(void)> finallyCallback = [this] {
+ nlsr.initialize();
+ };
std::function<void(std::list<Adjacent>::iterator)> thenCallback =
- [this, &thenCallback, &nCanonizationsLeft] (std::list<Adjacent>::iterator iterator) {
+ [this, &thenCallback, &finallyCallback, &nCanonizationsLeft] (std::list<Adjacent>::iterator iterator) {
nCanonizationsLeft--;
- nlsr.canonizeNeighborUris(iterator, thenCallback);
+ nlsr.canonizeNeighborUris(iterator, thenCallback, finallyCallback);
};
nlsr.canonizeNeighborUris(nlsr.getAdjacencyList().getAdjList().begin(),
- [thenCallback] (std::list<Adjacent>::iterator iterator) {
+ [&thenCallback, &finallyCallback] (std::list<Adjacent>::iterator iterator) {
thenCallback(iterator);
- });
+ },
+ finallyCallback);
while (nCanonizationsLeft != 0) {
this->advanceClocks(ndn::time::milliseconds(1));
}