void ObserveCache::onObserve(const HeaderOptions &,
const ResponseStatement & rep, int _result, unsigned int)
{
- if (!convertOCResultToSuccess((OCStackResult)_result))
+ std::lock_guard<std::mutex> lock(m_cbMutex);
+ m_state = CACHE_STATE::READY;
+
+ if (m_attributes == rep.getAttributes() &&
+ convertOCResultToSuccess((OCStackResult)_result))
{
return;
}
- m_state = CACHE_STATE::READY;
-
- if (m_attributes == rep.getAttributes())
+ if (m_reportCB)
{
- return ;
+ m_attributes = rep.getAttributes();
+ m_reportCB(m_wpResource.lock(), m_attributes, _result);
}
-
- m_attributes = rep.getAttributes();
- m_reportCB(m_wpResource.lock(), m_attributes);
}
void ObserveCache::verifyObserveCB(const HeaderOptions &_hos,