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 ee7fa3d902c371..d25beb3c58af8f 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -272,11 +272,6 @@ const FabricInfo * RetrieveCurrentFabric(CommandHandler * aCommandHandler) CHIP_ERROR DeleteFabricFromTable(FabricIndex fabricIndex) { ReturnErrorOnFailure(Server::GetInstance().GetFabricTable().Delete(fabricIndex)); - - // We need to withdraw the advertisement for the now-removed fabric, so need - // to restart advertising altogether. - app::DnssdServer::Instance().StartServer(); - return CHIP_NO_ERROR; } @@ -362,6 +357,10 @@ class OpCredsFabricTableDelegate : public chip::FabricTable::Delegate { ChipLogProgress(Zcl, "OpCreds: Fabric index 0x%x was removed", static_cast(fabricIndex)); + // We need to withdraw the advertisement for the now-removed fabric, so need + // to restart advertising altogether. + app::DnssdServer::Instance().StartServer(); + EventManagement::GetInstance().FabricRemoved(fabricIndex); NotifyFabricTableChanged();