Moving some logic of dealing with sequence numbers to SyncAppDataFetch
Adding recursive mutexes to SyncLogic, so hopefully it is now thread-safe
Small modification of publishing/retrieval names. Now session ID is
appended by SyncAppDataFetch / SyncAppDataPublish
diff --git a/model/sync-full-state.cc b/model/sync-full-state.cc
index ed3a3ee..748e408 100644
--- a/model/sync-full-state.cc
+++ b/model/sync-full-state.cc
@@ -81,7 +81,7 @@
}
// from State
-bool
+boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
FullState::update (NameInfoConstPtr info, const SeqNo &seq)
{
#ifndef STANDALONE
@@ -96,16 +96,20 @@
if (item == m_leaves.end ())
{
m_leaves.insert (make_shared<FullLeaf> (info, cref (seq)));
+ return make_tuple (true, false, SeqNo ());
}
else
{
if ((*item)->getSeq () == seq || seq < (*item)->getSeq ())
- return false;
-
+ {
+ return make_tuple (false, false, SeqNo ());
+ }
+
+ SeqNo old = (*item)->getSeq ();
m_leaves.modify (item,
ll::bind (&Leaf::setSeq, *ll::_1, seq));
+ return make_tuple (false, true, old);
}
- return true;
}
bool
@@ -122,7 +126,7 @@
LeafContainer::iterator item = m_leaves.find (info);
if (item != m_leaves.end ())
{
- m_leaves.erase (info);
+ m_leaves.erase (item);
return true;
}
else