Amend previous commit
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index f9f8537..c4a8487 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -181,17 +181,17 @@
{
recursive_mutex::scoped_lock lock (m_stateMutex);
- string last = name.substr(name.find_last_of("/") + 1);
- istringstream ss (dataBuffer);
+ string last = name.substr(name.find_last_of("/") + 1);
+ istringstream ss (dataBuffer);
- if (last == "state")
- {
- FullState full;
- ss >> full;
+ if (last == "state")
+ {
+ FullState full;
+ ss >> full;
BOOST_FOREACH (LeafConstPtr leaf, full.getLeaves()) // order doesn't matter
- {
- NameInfoConstPtr info = leaf->getInfo ();
- SeqNo seq = leaf->getSeq ();
+ {
+ NameInfoConstPtr info = leaf->getInfo ();
+ SeqNo seq = leaf->getSeq ();
bool inserted = false;
bool updated = false;
@@ -202,22 +202,22 @@
{
diffLog->update (info, seq);
m_onUpdate (info->toString (), seq.getSeq(), oldSeq);
- }
- }
+ }
+ }
}
- else
- {
- DiffState diff;
- ss >> diff;
- BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
- {
+ else
+ {
+ DiffState diff;
+ ss >> diff;
+ BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
+ {
DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
BOOST_ASSERT (diffLeaf != 0);
- NameInfoConstPtr info = diffLeaf->getInfo();
+ NameInfoConstPtr info = diffLeaf->getInfo();
if (diffLeaf->getOperation() == UPDATE)
{
- SeqNo seq = diffLeaf->getSeq();
+ SeqNo seq = diffLeaf->getSeq();
bool inserted = false;
bool updated = false;
@@ -228,8 +228,8 @@
{
diffLog->update (info, seq);
m_onUpdate (info->toString (), seq.getSeq(), oldSeq);
- }
- }
+ }
+ }
else if (diffLeaf->getOperation() == REMOVE)
{
if (m_state.remove (info))
@@ -245,8 +245,8 @@
}
}
- diffLog->setDigest(m_state.getDigest());
- m_log.insert (diffLog);
+ diffLog->setDigest(m_state.getDigest());
+ m_log.insert (diffLog);
}
catch (Error::SyncXmlDecodingFailure &e)
{
@@ -256,31 +256,17 @@
if (diffLog->getLeaves ().size () > 0)
{
- // notify upper layer
- BOOST_FOREACH (LeafConstPtr leaf, diffLog->getLeaves ())
- {
+ // notify upper layer
+ BOOST_FOREACH (LeafConstPtr leaf, diffLog->getLeaves ())
+ {
DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
BOOST_ASSERT (diffLeaf != 0);
- // m_fetchCallback (prefix, 1, seq.getSeq());
- }
+ // m_fetchCallback (prefix, 1, seq.getSeq());
+ }
- sendSyncInterest();
-}
-}
-
-void
-SyncLogic::processPendingSyncInterests(DiffStatePtr &diff) {
- diff->setDigest(m_state.getDigest());
- m_log.insert(diff);
-
- vector<string> pis = m_syncInterestTable.fetchAll ();
- stringstream ss;
- ss << *diff;
- for (vector<string>::iterator ii = pis.begin(); ii != pis.end(); ++ii)
- {
- m_ccnxHandle->publishData (*ii, ss.str(), m_syncResponseFreshness);
- }
+ sendSyncInterest();
+ }
}
void