Modifying logic with interest re-expression when it is satisfied by data
a) If state has changed, re-express immediately
b) If state has not changed, schedule re-expression in `m_syncResponseFreshness' seconds (2sec)
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index a5244df..a954db8 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -211,13 +211,23 @@
}
catch (Error::SyncXmlDecodingFailure &e)
{
- // log error
- return;
+ diffLog.reset ();
+ // don't do anything
}
+ // if state has changed, then it is safe to express a new interest
if (diffLog->getLeaves ().size () > 0)
{
- sendSyncInterest();
+ sendSyncInterest ();
+ }
+ else
+ {
+ // should not reexpress the same interest. Need at least wait for data lifetime
+ // Otherwise we will get immediate reply from the local daemon and there will be 100% utilization
+ m_scheduler.cancel (REEXPRESSING_INTEREST);
+ m_scheduler.schedule (posix_time::seconds (m_syncResponseFreshness),
+ bind (&SyncLogic::sendSyncInterest, this),
+ REEXPRESSING_INTEREST);
}
}