comm: Stop SyncLogicHandler from fetching own LSAs

refs: #2005

Change-Id: I717a5258673dd5308fdf6561dbdb626ae4c74e9f
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 0490276..427cc0b 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -564,16 +564,24 @@
                 getLsaExpirationTimePoint(),
                 m_nlsr.getAdjacencyList().getNumOfActiveNeighbor(),
                 m_nlsr.getAdjacencyList());
+
   m_nlsr.getSequencingManager().increaseAdjLsaSeq();
-  // publish routing update
-  //ndn::Name lsaPrefix = m_nlsr.getConfParameter().getLsaPrefix();
-  //lsaPrefix.append(m_nlsr.getConfParameter().getRouterPrefix());
+
+  bool isInstalled = installAdjLsa(adjLsa);
+
+  // Delay Sync prefix registration until the first Adjacency LSA is built
+  if (isInstalled && !m_hasSyncPrefixBeenRegistered) {
+    m_nlsr.getSyncLogicHandler().createSyncSocket();
+    m_hasSyncPrefixBeenRegistered = true;
+  }
+
   ndn::Name lsaPrefix = m_nlsr.getConfParameter().getLsaPrefix();
   lsaPrefix.append(m_nlsr.getConfParameter().getSiteName());
   lsaPrefix.append(m_nlsr.getConfParameter().getRouterName());
-  m_nlsr.getSyncLogicHandler().publishRoutingUpdate(m_nlsr.getSequencingManager(),
-                                                    lsaPrefix);
-  return installAdjLsa(adjLsa);
+
+  m_nlsr.getSyncLogicHandler().publishRoutingUpdate(m_nlsr.getSequencingManager(), lsaPrefix);
+
+  return isInstalled;
 }
 
 bool