Revert "[CONPRO-1337] Disabled Presence Feature"
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceCache / src / ObserveCache.cpp
index 637faf9..2703af7 100644 (file)
@@ -102,22 +102,19 @@ namespace OIC
         void ObserveCache::onObserve(const HeaderOptions &,
                        const ResponseStatement & rep, int _result, unsigned int)
         {
-            if (!convertOCResultToSuccess((OCStackResult)_result))
-            {
-                return;
-            }
-
+            std::lock_guard<std::mutex> lock(m_cbMutex);
             m_state = CACHE_STATE::READY;
 
-            if (m_attributes == rep.getAttributes())
+            if (m_attributes == rep.getAttributes() &&
+                    convertOCResultToSuccess((OCStackResult)_result))
             {
-                return ;
+                return;
             }
 
-            m_attributes = rep.getAttributes();
             if (m_reportCB)
             {
-                m_reportCB(m_wpResource.lock(), m_attributes);
+                m_attributes = rep.getAttributes();
+                m_reportCB(m_wpResource.lock(), m_attributes, _result);
             }
         }