Skip to content

Commit

Permalink
[op-creds] Fix RemoveFabric on Sleepy End Devices (#16110)
Browse files Browse the repository at this point in the history
RemoveFabric command sent for the current fabric crashes
on Sleepy End Devices because UpdateSEDPollingMode() method,
used to switch between fast and slow polling mode,
references a session object that is released by the command.

By the way, remove a debug printf().
  • Loading branch information
Damian-Nordic authored Mar 14, 2022
1 parent 121263f commit 6e76729
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ class OpCredsFabricTableDelegate : public FabricTableDelegate
// Gets called when a fabric is deleted from KVS store
void OnFabricDeletedFromStorage(CompressedFabricId compressedFabricId, FabricIndex fabricId) override
{
printf("OpCredsFabricTableDelegate::OnFabricDeletedFromStorage\n");
emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Fabric 0x%u was deleted from fabric storage.", fabricId);
fabricListChanged();

Expand Down
8 changes: 8 additions & 0 deletions src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout)
#if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED
void ExchangeContext::UpdateSEDPollingMode()
{
if (!HasSessionHandle())
{
// After the session has been deleted, no further communication can occur on the exchange,
// so withdraw a SED fast-polling mode request.
UpdateSEDPollingMode(false);
return;
}

Transport::PeerAddress address;

switch (GetSessionHandle()->GetSessionType())
Expand Down

0 comments on commit 6e76729

Please sign in to comment.