From d86a86ebb17fc072e84aaa743030864154d551f8 Mon Sep 17 00:00:00 2001 From: coderhyme Date: Sun, 13 Mar 2016 19:57:32 -0700 Subject: [PATCH] Fixed a bug in the cache module of RE If observation for a resource from a client is started, it should be canceled. But there was a logic error that it isn't. Change-Id: I2440c20999b7076bea5987ccbad3f0710269b3d9 Signed-off-by: coderhyme Reviewed-on: https://gerrit.iotivity.org/gerrit/5807 Tested-by: jenkins-iotivity Reviewed-by: JungYong KIM (cherry picked from commit 607ef0e262f85d164cb3b1edbcf2e5bf926a2930) Reviewed-on: https://gerrit.iotivity.org/gerrit/6259 --- .../resource-encapsulation/src/resourceCache/src/DataCache.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp b/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp index 86a1428..51b3536 100644 --- a/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp +++ b/service/resource-encapsulation/src/resourceCache/src/DataCache.cpp @@ -42,10 +42,10 @@ namespace OIC const HeaderOptions &_hos, const ResponseStatement &_rep, int _result, unsigned int _seq, std::weak_ptr rpPtr) { - std::shared_ptr Ptr = rpPtr.lock(); - if (Ptr) + std::shared_ptr ptr = rpPtr.lock(); + if (ptr) { - Ptr->onObserve(_hos, _rep, _result, _seq); + ptr->onObserve(_hos, _rep, _result, _seq); } } @@ -100,7 +100,7 @@ namespace OIC subscriberList.release(); } - if (mode == CACHE_MODE::OBSERVE) + if (sResource->isObservable()) { try { @@ -184,7 +184,7 @@ namespace OIC const PrimitiveResourcePtr DataCache::getPrimitiveResource() const { - return (sResource != nullptr) ? sResource : nullptr; + return sResource; } const RCSResourceAttributes DataCache::getCachedData() const -- 2.7.4