Skip to content

Commit

Permalink
Clear endpoint bitmask before reporting the PartList attribute
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ArekBalysNordic committed Oct 11, 2023
1 parent c534070 commit 71d158c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,10 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable)
{
emAfEndpoints[index].bitmask.Set(EmberAfEndpointOptions::isEnabled);
}
else
{
emAfEndpoints[index].bitmask.Clear(EmberAfEndpointOptions::isEnabled);
}

#if defined(EZSP_HOST)
ezspSetEndpointFlags(endpoint, (enable ? EZSP_ENDPOINT_ENABLED : EZSP_ENDPOINT_DISABLED));
Expand Down Expand Up @@ -963,11 +967,6 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable)
app::Clusters::Descriptor::Attributes::PartsList::Id);
}

if (!enable)
{
emAfEndpoints[index].bitmask.Clear(EmberAfEndpointOptions::isEnabled);
}

return true;
}

Expand Down

0 comments on commit 71d158c

Please sign in to comment.