From 888bc96303a22443ab4d75e225803268267956b0 Mon Sep 17 00:00:00 2001 From: Ziran Sun Date: Wed, 21 Sep 2016 11:02:23 +0100 Subject: [PATCH] Delete Client callback when receive observe cancel response. Bug: https://jira.iotivity.org/browse/IOT-1317 Change-Id: I4e5ef2a1c848b963c036efe4ddf73dfd76b2b262 Signed-off-by: Ziran Sun Reviewed-on: https://gerrit.iotivity.org/gerrit/12055 Tested-by: jenkins-iotivity --- resource/csdk/stack/include/internal/ocobserve.h | 3 --- resource/csdk/stack/include/octypes.h | 6 ++++++ resource/src/InProcClientWrapper.cpp | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/resource/csdk/stack/include/internal/ocobserve.h b/resource/csdk/stack/include/internal/ocobserve.h index 1a98969..1477d05 100644 --- a/resource/csdk/stack/include/internal/ocobserve.h +++ b/resource/csdk/stack/include/internal/ocobserve.h @@ -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) diff --git a/resource/csdk/stack/include/octypes.h b/resource/csdk/stack/include/octypes.h index 7fd01d8..7fc8300 100644 --- a/resource/csdk/stack/include/octypes.h +++ b/resource/csdk/stack/include/octypes.h @@ -1017,6 +1017,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. */ typedef enum diff --git a/resource/src/InProcClientWrapper.cpp b/resource/src/InProcClientWrapper.cpp index b5b2b37..7166e44 100644 --- a/resource/src/InProcClientWrapper.cpp +++ b/resource/src/InProcClientWrapper.cpp @@ -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; } -- 2.7.4