nlsr: canonize Adjacent FaceURIs on startup

Change-Id: I6a2b31631918c1ece79c3fc13e392917162efc2d
refs: #4063
diff --git a/src/nlsr-runner.cpp b/src/nlsr-runner.cpp
index d5bf709..29e4737 100644
--- a/src/nlsr-runner.cpp
+++ b/src/nlsr-runner.cpp
@@ -57,8 +57,16 @@
     m_nlsr.daemonize();
   }
 
-  m_nlsr.initialize();
-
+  /**
+   * 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.
+   */
+  m_nlsr.canonizeNeighborUris(m_nlsr.getAdjacencyList().getAdjList().begin(),
+                              [this] (std::list<Adjacent>::iterator iterator) {
+                                m_nlsr.canonizeContinuation(iterator);
+                              });
   try {
     m_nlsr.startEventLoop();
   }