Adding getNumberOfBranches method to sync logic
diff --git a/include/sync-logic.h b/include/sync-logic.h
index 5e32918..d0500c8 100644
--- a/include/sync-logic.h
+++ b/include/sync-logic.h
@@ -157,11 +157,14 @@
void
sendSyncData (const std::string &name,
DigestConstPtr digest, StateConstPtr state);
+
+ size_t
+ getNumberOfBranches () const;
private:
FullStatePtr m_state;
DiffStateContainer m_log;
- boost::recursive_mutex m_stateMutex;
+ mutable boost::recursive_mutex m_stateMutex;
std::string m_outstandingInterestName;
SyncInterestTable m_syncInterestTable;
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index de7182e..d91923c 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -577,5 +577,12 @@
return os.str();
}
+size_t
+SyncLogic::getNumberOfBranches () const
+{
+ recursive_mutex::scoped_lock lock (m_stateMutex);
+ return m_state->getLeaves ().size ();
+}
+
}