Revert "[CONPRO-1337] Disabled Presence Feature"
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceCache / src / ObserveCache.cpp
index 132c01c..2703af7 100644 (file)
@@ -102,20 +102,20 @@ namespace OIC
         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,