Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Aug 11, 2022
1 parent 28b0941 commit 8d41362
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/app/InteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ void InteractionModelEngine::Shutdown()
//
while (handlerIter)
{
CommandHandlerInterface * pNext = handlerIter->GetNext();
CommandHandlerInterface * nextHandler = handlerIter->GetNext();
handlerIter->SetNext(nullptr);
handlerIter = pNext;
handlerIter = nextHandler;
}

mCommandHandlerList = nullptr;
Expand Down Expand Up @@ -1452,8 +1452,9 @@ void InteractionModelEngine::OnFabricRemoved(const FabricTable & fabricTable, Fa
if (readClient->GetFabricIndex() == fabricIndex)
{
ChipLogProgress(InteractionModel, "Fabric removed, deleting obsolete read client with FabricIndex: %u", fabricIndex);
readClient->Close(CHIP_NO_ERROR, false);
RemoveReadClient(readClient);
readClient->mpImEngine = nullptr;
readClient->Close(CHIP_ERROR_IM_FABRIC_DELETED, false);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/app/InteractionModelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
*/
uint16_t GetMinGuaranteedSubscriptionsPerFabric() const;

// virtual method from FabricTable::Delegate
void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override;

#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
Expand Down
2 changes: 1 addition & 1 deletion src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ReadClient::~ReadClient()
// This won't be the case if the engine shut down before this destructor was called (in which case, mpImEngine
// will point to null)
//
if (mpImEngine && mpImEngine->InActiveReadClientList(this))
if (mpImEngine)
{
mpImEngine->RemoveReadClient(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ class OpCredsFabricTableDelegate : public chip::FabricTable::Delegate
// Gets called when a fabric is added/updated, but not necessarily committed to storage
void OnFabricUpdated(const FabricTable & fabricTable, FabricIndex fabricIndex) override
{
ChipLogProgress(InteractionModel, "OnFabricUpdated debugging from opertonal-credential!!!!!!!");
NotifyFabricTableChanged();
}

Expand Down
3 changes: 3 additions & 0 deletions src/lib/core/CHIPError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err)
case CHIP_ERROR_MISSING_URI_SEPARATOR.AsInteger():
desc = "The URI separator is missing";
break;
case CHIP_ERROR_IM_FABRIC_DELETED.AsInteger():
desc = "The fabric is deleted, and the corresponding IM resources are released";
break;
}
#endif // !CHIP_CONFIG_SHORT_ERROR_STR

Expand Down
8 changes: 8 additions & 0 deletions src/lib/core/CHIPError.h
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,14 @@ using CHIP_ERROR = ::chip::ChipError;
*/
#define CHIP_ERROR_MISSING_URI_SEPARATOR CHIP_CORE_ERROR(0xe0)

/**
* @def CHIP_ERROR_IM_FABRIC_DELETED
*
* @brief
* The fabric is deleted, and the corresponding IM resources are released
*/
#define CHIP_ERROR_IM_FABRIC_DELETED CHIP_CORE_ERROR(0xe1)

// clang-format on

// !!!!! IMPORTANT !!!!! If you add new CHIP errors, please update the translation
Expand Down

0 comments on commit 8d41362

Please sign in to comment.