Implementing hash indexing of DiffStateContainer
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 6ba2c7a..754c995 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -179,19 +179,19 @@
SyncLogic::respondSyncInterest (const string &interest)
{
string hash = interest.substr(interest.find_last_of("/") + 1);
- Digest digest;
- digest << hash;
+ DigestPtr digest = make_shared<Digest> ();
+ *digest << hash;
+ digest->finalize ();
- if (*m_state.getDigest() == digest)
+ if (*m_state.getDigest() == *digest)
{
- m_syncInterestTable.insert(interest);
+ m_syncInterestTable.insert (interest);
return;
}
-/*
- DiffStateContainer::index<hashed>::type& idx = m_log.get<hashed> ();
- DiffStateContainer::iterator ii = idx.find(digest);
- if (ii != idx.end())
+ DiffStateContainer::iterator ii = m_log.find (digest);
+
+ if (ii != m_log.end())
{
stringstream ss;
ss << *(*ii)->diff();
@@ -200,17 +200,17 @@
else
{
int wait = rand() % 80 + 20;
- sleep(wait/1000.0);
+ sleep(wait/1000.0); // ??? sleep in this thread???
}
-
- if (*m_state.getDigest() == digest)
+
+ if (*m_state.getDigest() == *digest)
{
m_syncInterestTable.insert(interest);
return;
}
- ii = idx.find(digest);
- if (ii != idx.end())
+ ii = m_log.find (digest);
+ if (ii != m_log.end ())
{
stringstream ss;
ss << *(*ii)->diff();
@@ -222,7 +222,6 @@
ss << m_state;
m_ccnxHandle->publishData(interest + "/state", ss.str(), m_syncResponseFreshness);
}
- */
}
void