Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.3-cherrypick] Fix reads on the group key management cluster to handle chunking correctly #37020

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface
VerifyOrReturnError(nullptr != provider, CHIP_ERROR_INTERNAL);

CHIP_ERROR err = aEncoder.EncodeList([provider](const auto & encoder) -> CHIP_ERROR {
CHIP_ERROR encodeStatus = CHIP_NO_ERROR;

for (auto & fabric : Server::GetInstance().GetFabricTable())
{
auto fabric_index = fabric.GetFabricIndex();
Expand All @@ -181,11 +183,19 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface
.groupKeySetID = mapping.keyset_id,
.fabricIndex = fabric_index,
};
encoder.Encode(key);
encodeStatus = encoder.Encode(key);
if (encodeStatus != CHIP_NO_ERROR)
{
break;
}
}
iter->Release();
if (encodeStatus != CHIP_NO_ERROR)
{
break;
}
}
return CHIP_NO_ERROR;
return encodeStatus;
});
return err;
}
Expand Down Expand Up @@ -255,6 +265,8 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface
VerifyOrReturnError(nullptr != provider, CHIP_ERROR_INTERNAL);

CHIP_ERROR err = aEncoder.EncodeList([provider](const auto & encoder) -> CHIP_ERROR {
CHIP_ERROR encodeStatus = CHIP_NO_ERROR;

for (auto & fabric : Server::GetInstance().GetFabricTable())
{
auto fabric_index = fabric.GetFabricIndex();
Expand All @@ -264,11 +276,19 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface
GroupDataProvider::GroupInfo info;
while (iter->Next(info))
{
encoder.Encode(GroupTableCodec(provider, fabric_index, info));
encodeStatus = encoder.Encode(GroupTableCodec(provider, fabric_index, info));
if (encodeStatus != CHIP_NO_ERROR)
{
break;
}
}
iter->Release();
if (encodeStatus != CHIP_NO_ERROR)
{
break;
}
}
return CHIP_NO_ERROR;
return encodeStatus;
});
return err;
}
Expand Down
Loading
Loading