nlsr: Added a finally() to canonizeNeighborUris

Change-Id: I0046ae7a07be69f20a8f9d2b4acb33d8533a28e7
refs: #4128
diff --git a/src/nlsr-runner.cpp b/src/nlsr-runner.cpp
index 827593a..84ec812 100644
--- a/src/nlsr-runner.cpp
+++ b/src/nlsr-runner.cpp
@@ -57,15 +57,18 @@
     m_nlsr.daemonize();
   }
 
-  /**
-   * This really should be part of Nlsr::initialize, but because URI
-   * canonization happens asynchronously and we need to ensure that it
-   * happens before we proceed, the canonization function has to be
-   * the one to call initialize.
-   */
+  /** Because URI canonization needs to occur before initialization,
+      we have to pass initialize as the finally() in neighbor
+      canonization.
+  */
   m_nlsr.canonizeNeighborUris(m_nlsr.getAdjacencyList().getAdjList().begin(),
                               [this] (std::list<Adjacent>::iterator iterator) {
-                                m_nlsr.canonizeContinuation(iterator);
+                                m_nlsr.canonizeContinuation(iterator, [this] {
+                                    m_nlsr.initialize();
+                                  });
+                              },
+                              [this] {
+                                m_nlsr.initialize();
                               });
   try {
     m_nlsr.startEventLoop();