src: onFaceEventNotification only proceed if face id was zero or updated

refs: #5010

Change-Id: Ie5b1f8a5ca2a372890a9ef2a28dc00e1a7c0a366
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index a6da9a0..9a62a24 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -483,14 +483,16 @@
         return;
       }
       auto adjacent = m_adjacencyList.findAdjacent(faceUri);
+      uint64_t faceId = faceEventNotification.getFaceId();
 
-      // If we have a neighbor by that FaceUri and it has no FaceId, we
-      // have a match.
-      if (adjacent != m_adjacencyList.end()) {
+      // If we have a neighbor by that FaceUri and it has no FaceId or
+      // the FaceId is different from ours, we have a match.
+      if (adjacent != m_adjacencyList.end() &&
+          (adjacent->getFaceId() == 0 || adjacent->getFaceId() != faceId))
+      {
         NLSR_LOG_DEBUG("Face creation event matches neighbor: " << adjacent->getName()
-                   << ". New Face ID: " << faceEventNotification.getFaceId()
-                   << ". Registering prefixes.");
-        adjacent->setFaceId(faceEventNotification.getFaceId());
+                        << ". New Face ID: " << faceId << ". Registering prefixes.");
+        adjacent->setFaceId(faceId);
 
         registerAdjacencyPrefixes(*adjacent, ndn::time::milliseconds::max());