Leaf::getInfo () now returns boost::shared_ptr<const NameInfo> instead of NameInfo reference as before.
SyncLogic is temporarily broken
diff --git a/model/sync-full-state.cc b/model/sync-full-state.cc
index e8a2149..ed3a3ee 100644
--- a/model/sync-full-state.cc
+++ b/model/sync-full-state.cc
@@ -81,7 +81,7 @@
}
// from State
-void
+bool
FullState::update (NameInfoConstPtr info, const SeqNo &seq)
{
#ifndef STANDALONE
@@ -92,18 +92,23 @@
m_digest.reset ();
- LeafContainer::iterator item = m_leaves.find (*info);
+ LeafContainer::iterator item = m_leaves.find (info);
if (item == m_leaves.end ())
{
m_leaves.insert (make_shared<FullLeaf> (info, cref (seq)));
}
else
{
- m_leaves.modify (item, ll::bind (&Leaf::setSeq, *ll::_1, seq));
+ if ((*item)->getSeq () == seq || seq < (*item)->getSeq ())
+ return false;
+
+ m_leaves.modify (item,
+ ll::bind (&Leaf::setSeq, *ll::_1, seq));
}
+ return true;
}
-void
+bool
FullState::remove (NameInfoConstPtr info)
{
#ifndef STANDALONE
@@ -114,7 +119,14 @@
m_digest.reset ();
- m_leaves.erase (*info);
+ LeafContainer::iterator item = m_leaves.find (info);
+ if (item != m_leaves.end ())
+ {
+ m_leaves.erase (info);
+ return true;
+ }
+ else
+ return false;
}
} // Sync