Correct newly introduced bugs in sync logic
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 0fd41af..13b66f5 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -126,8 +126,10 @@
BOOST_ASSERT (name.find (m_syncPrefix) == 0);
string hash = name.substr (m_syncPrefix.size (), name.size ()-m_syncPrefix.size ());
+ if (hash[0] == '/')
+ hash = hash.substr (1, hash.size ()-1);
string interestType = "normal";
-
+
size_t pos = hash.find ('/');
if (pos != string::npos)
{
@@ -299,19 +301,24 @@
}
catch (Error::SyncXmlDecodingFailure &e)
{
+ _LOG_TRACE ("Something really fishy happened during state decoding " <<
+ diagnostic_information (e));
diffLog.reset ();
// don't do anything
}
- BOOST_ASSERT (diffLog->getLeaves ().size () > 0);
+ if (diffLog != 0)
+ {
+ BOOST_ASSERT (diffLog->getLeaves ().size () > 0);
- satisfyPendingSyncInterests (diffLog); // if there are interests in PIT, there is a point to satisfy them using new state
+ satisfyPendingSyncInterests (diffLog); // if there are interests in PIT, there is a point to satisfy them using new state
- // if state has changed, then it is safe to express a new interest
- m_scheduler.cancel (REEXPRESSING_INTEREST);
- m_scheduler.schedule (TIME_SECONDS_WITH_JITTER (0),
- bind (&SyncLogic::sendSyncInterest, this),
- REEXPRESSING_INTEREST);
+ // if state has changed, then it is safe to express a new interest
+ m_scheduler.cancel (REEXPRESSING_INTEREST);
+ m_scheduler.schedule (TIME_SECONDS_WITH_JITTER (0),
+ bind (&SyncLogic::sendSyncInterest, this),
+ REEXPRESSING_INTEREST);
+ }
}
void
@@ -422,9 +429,12 @@
void
SyncLogic::sendSyncData (const std::string &name, DigestConstPtr digest, StateConstPtr state)
{
-
// sending
+ m_ccnxHandle->publishData (name,
+ lexical_cast<string> (*state),
+ m_syncResponseFreshness); // in NS-3 it doesn't have any effect... yet
+ // checking if our own interest got satisfied
bool satisfiedOwnInterest = false;
{
recursive_mutex::scoped_lock lock (m_stateMutex);