route: Ensure nexthops are reregistered correctly

Reregister prefixes if nexthops don't change
Remove invalid nexthops instead of all of them
Cancel FibEntry expiration events before scheduling new ones
Remove FibEntry refreshing
Add grace period to LSA expiration

refs: #1892

Change-Id: I5136b6b0f52a47b6ba72e04b0cea81b85ebccd45
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index dc7882d..74daed4 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -33,6 +33,8 @@
 
 INIT_LOGGER("Lsdb");
 
+const ndn::time::seconds Lsdb::GRACE_PERIOD = ndn::time::seconds(10);
+
 using namespace std;
 
 void
@@ -91,7 +93,7 @@
 Lsdb::scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
                                 const ndn::time::seconds& expTime)
 {
-  return m_nlsr.getScheduler().scheduleEvent(expTime,
+  return m_nlsr.getScheduler().scheduleEvent(expTime + GRACE_PERIOD,
                                              ndn::bind(&Lsdb::exprireOrRefreshNameLsa,
                                                        this, key, seqNo));
 }
@@ -297,7 +299,7 @@
 Lsdb::scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
                                       const ndn::time::seconds& expTime)
 {
-  return m_nlsr.getScheduler().scheduleEvent(expTime,
+  return m_nlsr.getScheduler().scheduleEvent(expTime + GRACE_PERIOD,
                                              ndn::bind(&Lsdb::exprireOrRefreshCoordinateLsa,
                                                        this, key, seqNo));
 }
@@ -503,7 +505,7 @@
 Lsdb::scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
                                const ndn::time::seconds& expTime)
 {
-  return m_nlsr.getScheduler().scheduleEvent(expTime,
+  return m_nlsr.getScheduler().scheduleEvent(expTime + GRACE_PERIOD,
                                              ndn::bind(&Lsdb::exprireOrRefreshAdjLsa,
                                                        this, key, seqNo));
 }