Delete Client callback when receive observe cancel response.
authorZiran Sun <ziran.sun@samsung.com>
Wed, 21 Sep 2016 10:02:23 +0000 (11:02 +0100)
committerZiran Sun <ziran.sun@samsung.com>
Tue, 27 Sep 2016 10:03:41 +0000 (10:03 +0000)
Bug: https://jira.iotivity.org/browse/IOT-1317
Change-Id: I4e5ef2a1c848b963c036efe4ddf73dfd76b2b262
Signed-off-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12055
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
(cherry picked from commit 888bc96303a22443ab4d75e225803268267956b0)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12213
Reviewed-by: Habib Virji <habib.virji@samsung.com>
resource/csdk/stack/include/internal/ocobserve.h
resource/csdk/stack/include/octypes.h
resource/src/InProcClientWrapper.cpp

index 1a98969fd1ad383246bb7cd8c2c33af5ca80c164..1477d052e86783ad5b20221a01d4d4259b6944d3 100644 (file)
@@ -29,9 +29,6 @@
 #ifndef OC_OBSERVE_H
 #define OC_OBSERVE_H
 
-/** Sequence number is a 24 bit field, per https://tools.ietf.org/html/draft-ietf-core-observe-16.*/
-#define MAX_SEQUENCE_NUMBER              (0xFFFFFF)
-
 /** Maximum number of observers to reach */
 
 #define MAX_OBSERVER_FAILED_COMM         (2)
index 3b8806eabe91bef9520f54b83017e43cbeb71c6c..0864196d66a91e9696701584be6ecb6006d93a67 100644 (file)
@@ -1016,6 +1016,12 @@ typedef void * OCRequestHandle;
  */
 typedef uint8_t OCObservationId;
 
+/**
+ * Sequence number is a 24 bit field,
+ * per https://tools.ietf.org/html/rfc7641.
+ */
+#define MAX_SEQUENCE_NUMBER              (0xFFFFFF)
+
 /**
  * Action associated with observation.
  */
index b5b2b377a1ddca97904d65e54dc1b3f0eee7c310..7166e443afde85d2112fbe4cb6ccb7cb0707192e 100644 (file)
@@ -1028,6 +1028,10 @@ namespace OC
         std::thread exec(context->callback, serverHeaderOptions, attrs,
                     result, sequenceNumber);
         exec.detach();
+        if (sequenceNumber == MAX_SEQUENCE_NUMBER + 1)
+        {
+            return OC_STACK_DELETE_TRANSACTION;
+        }
 
         return OC_STACK_KEEP_TRANSACTION;
     }