From 87e4afe94cd7aaab2967eab3ac8e7a19b75fd3c4 Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Thu, 12 Jan 2023 19:43:05 -0800 Subject: [PATCH] Addressed CI issues, and disabled subscription persistence and resumption for cc13x2_26x2 and CYW30739 --- .../SimpleSubscriptionResumptionStorage.cpp | 35 +++++++++---------- .../Infineon/CYW30739/CHIPPlatformConfig.h | 3 ++ src/platform/cc13x2_26x2/CHIPPlatformConfig.h | 3 ++ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/app/SimpleSubscriptionResumptionStorage.cpp b/src/app/SimpleSubscriptionResumptionStorage.cpp index 11e5220b1b2359..b85395b17cd61f 100644 --- a/src/app/SimpleSubscriptionResumptionStorage.cpp +++ b/src/app/SimpleSubscriptionResumptionStorage.cpp @@ -202,7 +202,7 @@ CHIP_ERROR SimpleSubscriptionResumptionStorage::FindByScopedNodeId(ScopedNodeId if (pathCount) { subscriptions.mSubscriptions[i].mAttributePaths.Calloc(pathCount); - for (uint8_t j = 0; j < pathCount; j++) + for (uint16_t j = 0; j < pathCount; j++) { ReturnErrorOnFailure(reader.Next(kEndpointIdTag)); ReturnErrorOnFailure(reader.Get(subscriptions.mSubscriptions[i].mAttributePaths[j].mEndpointId)); @@ -224,7 +224,7 @@ CHIP_ERROR SimpleSubscriptionResumptionStorage::FindByScopedNodeId(ScopedNodeId if (pathCount) { subscriptions.mSubscriptions[i].mEventPaths.Calloc(pathCount); - for (uint8_t j = 0; j < pathCount; j++) + for (uint16_t j = 0; j < pathCount; j++) { EventPathType eventPathType; ReturnErrorOnFailure(reader.Next(kPathTypeTag)); @@ -423,30 +423,29 @@ CHIP_ERROR SimpleSubscriptionResumptionStorage::Delete(const SubscriptionInfo & { if (subscriptions.mSize) { + ChipLogProgress(DataManagement, "JEFFTEST: - save smaller set"); return SaveSubscriptions(subscriptionNode, subscriptions); } - else + + // Remove node from index + SubscriptionIndex subscriptionIndex; + LoadIndex(subscriptionIndex); + for (size_t i = 0; i < subscriptionIndex.mSize; i++) { - // Remove node from index - SubscriptionIndex subscriptionIndex; - LoadIndex(subscriptionIndex); - for (size_t i = 0; i < subscriptionIndex.mSize; i++) + if (subscriptionNode == subscriptionIndex.mNodes[i]) { - if (subscriptionNode == subscriptionIndex.mNodes[i]) + subscriptionIndex.mSize--; + // if not last element, move last element here, essentially deleting this + if (i < subscriptionIndex.mSize) { - subscriptionIndex.mSize--; - // if not last element, move last element here, essentially deleting this - if (i < subscriptionIndex.mSize) - { - subscriptionIndex.mNodes[i] = std::move(subscriptionIndex.mNodes[subscriptionIndex.mSize]); - } - break; + subscriptionIndex.mNodes[i] = std::move(subscriptionIndex.mNodes[subscriptionIndex.mSize]); } + break; } - SaveIndex(subscriptionIndex); - - return mStorage->SyncDeleteKeyValue(GetStorageKey(subscriptionNode).KeyName()); } + SaveIndex(subscriptionIndex); + + return mStorage->SyncDeleteKeyValue(GetStorageKey(subscriptionNode).KeyName()); } return CHIP_NO_ERROR; diff --git a/src/platform/Infineon/CYW30739/CHIPPlatformConfig.h b/src/platform/Infineon/CYW30739/CHIPPlatformConfig.h index 12ee433af8c27d..c55fad0d87c408 100644 --- a/src/platform/Infineon/CYW30739/CHIPPlatformConfig.h +++ b/src/platform/Infineon/CYW30739/CHIPPlatformConfig.h @@ -27,3 +27,6 @@ #define CHIP_CONFIG_UNAUTHENTICATED_CONNECTION_POOL_SIZE 10 #define CHIP_DEVICE_CONFIG_ENABLE_JUST_IN_TIME_PROVISIONING 1 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_COMMISSIONABLE_DISCOVERY 1 + +// Disable subscription persistence and resumption until memory issues get sorted out +#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 0 diff --git a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h index 2a5981d4bbdea6..ca100ca9c498a9 100644 --- a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h @@ -68,3 +68,6 @@ #ifndef CHIP_CONFIG_MAX_FABRICS #define CHIP_CONFIG_MAX_FABRICS 5 #endif + +// Disable subscription persistence and resumption until memory issues get sorted out +#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 0