From 6257498048ee676e77e86e7d38bcbdc7d01d5348 Mon Sep 17 00:00:00 2001 From: Arkadiusz Balys Date: Tue, 10 Oct 2023 09:07:32 +0200 Subject: [PATCH] [nrf fromlist] Clear endpoint bitmask before reporting the PartList attribute When we set a low value to the minimum subscription interval for subscription for the PartList attribute of the Description cluster, and then remove a dynamic endpoint the related bitmask may change after reporting it to a controller. The controller receives the old number of endpoints and does not update it within the following subscriptions until the next change of the PartList attribute occurs. To resolve the issue the endpoint bitmask should be cleared before reporting the PartList attribute of the Descriptor cluster to avoid race conditions. [nrf] -> There is an old API and there is bitmask operation instead of the method Clear! --- src/app/util/attribute-storage.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 322c22cd54..07bf51e81d 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -925,6 +925,7 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) else { shutdownEndpoint(&(emAfEndpoints[index])); + emAfEndpoints[index].bitmask &= EMBER_AF_ENDPOINT_DISABLED; } EndpointId parentEndpointId = emberAfParentEndpointFromIndex(index); @@ -945,11 +946,6 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) app::Clusters::Descriptor::Attributes::PartsList::Id); } - if (!enable) - { - emAfEndpoints[index].bitmask &= EMBER_AF_ENDPOINT_DISABLED; - } - return true; }