Repair bug with zero-root digest detection
diff --git a/model/sync-digest.cc b/model/sync-digest.cc
index 7a5b605..3febf6d 100644
--- a/model/sync-digest.cc
+++ b/model/sync-digest.cc
@@ -129,14 +129,13 @@
}
bool
-Digest::zero () const
+Digest::isZero () const
{
if (m_buffer == 0)
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
<< errmsg_info_str ("Digest has not been yet finalized"));
- if (m_hashLength == 1 && m_buffer[0] == 0)
- return true;
+ return (m_hashLength == 1 && m_buffer[0] == 0);
}
@@ -175,7 +174,7 @@
std::size_t
Digest::getHash () const
{
- if (zero ()) return 0;
+ if (isZero ()) return 0;
if (sizeof (std::size_t) > m_hashLength)
{
diff --git a/model/sync-digest.h b/model/sync-digest.h
index 42cfd81..f3fd33b 100644
--- a/model/sync-digest.h
+++ b/model/sync-digest.h
@@ -114,7 +114,7 @@
* Zero-root hash is a valid hash that optimally represents an empty state
*/
bool
- zero () const;
+ isZero () const;
private:
Digest &
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 7eba7c6..a5244df 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -92,13 +92,14 @@
}
// Special case when state is not empty and we have received request with zero-root digest
- if (digest->zero ())
+ if (digest->isZero ())
{
m_ccnxHandle->publishData (interestName + "/state",
lexical_cast<string> (m_state),
m_syncResponseFreshness);
return;
}
+
DiffStateContainer::iterator stateInDiffLog = m_log.find (digest);