From: Yamin Al-Mousa Date: Wed, 7 Jan 2015 18:14:10 +0000 (-0800) Subject: Fixing OCCancel with High_QOS in observe isn't deleting CB. X-Git-Tag: 1.2.0+RC1~1999^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd3dd4b91f1bca31402240052199f2557ad1d055;p=platform%2Fupstream%2Fiotivity.git Fixing OCCancel with High_QOS in observe isn't deleting CB. (Bug IOT-126) Calling OCCancel should result in deleting all associated structures including callbacks. This also should happen when we deregister observation. Change-Id: I34dd67288873ce27919a12a1d5fe244ef80751b7 Signed-off-by: Yamin Al-Mousa --- diff --git a/resource/examples/simpleclientHQ.cpp b/resource/examples/simpleclientHQ.cpp index e3a6f2c..bc29da0 100644 --- a/resource/examples/simpleclientHQ.cpp +++ b/resource/examples/simpleclientHQ.cpp @@ -62,11 +62,11 @@ void onObserve(const HeaderOptions headerOptions, const OCRepresentation& rep, if(eCode == SUCCESS_RESPONSE) { std::cout << "OBSERVE RESULT:"<sequenceNumber; - if(clientResponse->result == OC_STACK_OK) { parseServerHeaderOptions(clientResponse, serverHeaderOptions); @@ -560,6 +559,10 @@ namespace OC std::thread exec(context->callback, serverHeaderOptions, attrs, clientResponse->result, sequenceNumber); exec.detach(); + if(sequenceNumber == OC_OBSERVE_DEREGISTER) + { + return OC_STACK_DELETE_TRANSACTION; + } return OC_STACK_KEEP_TRANSACTION; }