From 6a5f06b7594f9fa004c797d874aaa1a3aa74b953 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 16 Mar 2022 11:34:37 -0700 Subject: [PATCH] Don't reset AddNoc and UpdateNoc in CommissioningFailedTimerComplete --- .../operational-credentials-server.cpp | 13 ++----------- src/platform/FailSafeContext.cpp | 4 +--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 2f7101c35bb26c..e428de1aeccc67 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -264,23 +264,14 @@ FabricInfo * RetrieveCurrentFabric(CommandHandler * aCommandHandler) void FailSafeCleanup(FailSafeContext & failSafeContext) { - FabricInfo * fabricInfo = Server::GetInstance().GetFabricTable().FindFabricWithIndex(failSafeContext.GetFabricIndex()); - emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: Call to FailSafeCleanup"); - VerifyOrReturn(fabricInfo != nullptr); - // If an AddNOC or UpdateNOC command has been successfully invoked, terminate all CASE sessions associated with the Fabric // whose Fabric Index is recorded in the Fail-Safe context (see ArmFailSafe Command) by clearing any associated Secure // Session Context at the Server. if (failSafeContext.NocCommandHasBeenInvoked()) { - CASESessionManager * caseSessionManager = Server::GetInstance().GetCASESessionManager(); - - if (caseSessionManager) - { - caseSessionManager->ReleaseSessionsForFabric(fabricInfo->GetCompressedId()); - } + Server::GetInstance().GetSecureSessionManager().ExpireAllPairingsForFabric(failSafeContext.GetFabricIndex()); } // If an AddNOC command had been successfully invoked, achieve the equivalent effect of invoking the RemoveFabric command @@ -288,7 +279,7 @@ void FailSafeCleanup(FailSafeContext & failSafeContext) // command. if (failSafeContext.AddNocCommandHasBeenInvoked()) { - Server::GetInstance().GetFabricTable().Delete(fabricInfo->GetFabricIndex()); + Server::GetInstance().GetFabricTable().Delete(failSafeContext.GetFabricIndex()); } // If an UpdateNOC command had been successfully invoked, revert the state of operational key pair, NOC and ICAC for that diff --git a/src/platform/FailSafeContext.cpp b/src/platform/FailSafeContext.cpp index c13befbb6d39c6..5373b1b4941e35 100644 --- a/src/platform/FailSafeContext.cpp +++ b/src/platform/FailSafeContext.cpp @@ -44,9 +44,7 @@ void FailSafeContext::CommissioningFailedTimerComplete() event.CommissioningComplete.Status = CHIP_ERROR_TIMEOUT; CHIP_ERROR status = PlatformMgr().PostEvent(&event); - mFailSafeArmed = false; - mAddNocCommandHasBeenInvoked = false; - mUpdateNocCommandHasBeenInvoked = false; + mFailSafeArmed = false; if (status != CHIP_NO_ERROR) {