Observation without caching.
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceCache / src / DataCache.cpp
index 23ffd30..b397243 100644 (file)
@@ -255,19 +255,24 @@ namespace OIC
 
         void DataCache::notifyObservers(const RCSResourceAttributes Att, int eCode)
         {
+            bool same = true;
             {
                 std::lock_guard<std::mutex> lock(att_mutex);
-                if (attributes == Att)
+                if (attributes != Att)
                 {
-                    return;
+                    same = false;
+                    attributes = Att;
                 }
-                attributes = Att;
             }
 
             std::lock_guard<std::mutex> lock(m_mutex);
             for (auto &i : * subscriberList)
             {
-                if (i.second.first.rf == REPORT_FREQUENCY::UPTODATE)
+                if (i.second.first.rf == REPORT_FREQUENCY::WHENEVER_NOTIFIED)
+                {
+                    i.second.second(this->sResource, Att, eCode);
+                }
+                else if (i.second.first.rf == REPORT_FREQUENCY::UPTODATE && !same)
                 {
                     i.second.second(this->sResource, Att, eCode);
                 }