From 3c7158f977e9f637eeeb972b141c3b1f5ad584a1 Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Tue, 14 Jun 2022 22:49:32 +0800 Subject: [PATCH] Resolve comments: adjust function name --- src/messaging/ExchangeMgr.cpp | 18 ++---------------- src/messaging/ExchangeMgr.h | 6 +++--- src/transport/SessionManager.cpp | 2 +- src/transport/SessionManager.h | 6 +++--- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp index 00b0cf2a5fe60e..b9e133e75cdd53 100644 --- a/src/messaging/ExchangeMgr.cpp +++ b/src/messaging/ExchangeMgr.cpp @@ -376,26 +376,12 @@ void ExchangeManager::CloseAllContextsForDelegate(const ExchangeDelegate * deleg }); } -void ExchangeManager::AbortExchangeForFabricExceptOne(FabricIndex fabricIndex, ExchangeContext * exception) +void ExchangeManager::AbortExchangesForFabricExceptOne(FabricIndex fabricIndex, ExchangeContext * deferred) { mContextPool.ForEachActiveObject([&](auto * ec) { if (ec->HasSessionHandle() && ec->GetSessionHandle()->GetPeer().GetFabricIndex() == fabricIndex) { - if (ec == exception) - ec->SetAutoReleaseSession(); - else - ec->Abort(); - } - return Loop::Continue; - }); -} - -void ExchangeManager::AbortExchangeForNodeExceptOne(const ScopedNodeId & node, ExchangeContext * exception) -{ - mContextPool.ForEachActiveObject([&](auto * ec) { - if (ec->HasSessionHandle() && ec->GetSessionHandle()->GetPeer() == node) - { - if (ec == exception) + if (ec == deferred) ec->SetAutoReleaseSession(); else ec->Abort(); diff --git a/src/messaging/ExchangeMgr.h b/src/messaging/ExchangeMgr.h index 53e23b23cd4367..69dbd80a79ff40 100644 --- a/src/messaging/ExchangeMgr.h +++ b/src/messaging/ExchangeMgr.h @@ -183,9 +183,9 @@ class DLL_EXPORT ExchangeManager : public SessionMessageDelegate */ void CloseAllContextsForDelegate(const ExchangeDelegate * delegate); - // This 2 APIs are used by UpdateNOC command, to invalid all exchanges except the given one. - void AbortExchangeForFabricExceptOne(FabricIndex fabricIndex, ExchangeContext * exception); - void AbortExchangeForNodeExceptOne(const ScopedNodeId & node, ExchangeContext * exception); + // This API is used by UpdateNOC command, to abort all exchanges except the given one, whose abort is deferred until UpdateNOC + // command finishing its work. + void AbortExchangesForFabricExceptOne(FabricIndex fabricIndex, ExchangeContext * deferred); SessionManager * GetSessionManager() const { return mSessionManager; } diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 4560566656e547..8c90fccf145ee4 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -387,7 +387,7 @@ void SessionManager::ExpireAllPASEPairings() }); } -void SessionManager::ReleaseSessionForFabricExceptOne(FabricIndex fabricIndex, const SessionHandle & exception) +void SessionManager::ReleaseSessionsForFabricExceptOne(FabricIndex fabricIndex, const SessionHandle & deferred) { mSecureSessions.ForEachSession([&](auto session) { if (session->GetPeer().GetFabricIndex() == fabricIndex) diff --git a/src/transport/SessionManager.h b/src/transport/SessionManager.h index e8c8f85d47aa82..c57f7089f04725 100644 --- a/src/transport/SessionManager.h +++ b/src/transport/SessionManager.h @@ -176,9 +176,9 @@ class DLL_EXPORT SessionManager : public TransportMgrDelegate void ExpireAllPairingsForFabric(FabricIndex fabric); void ExpireAllPASEPairings(); - // This API is used by UpdateNOC command, to invalid all sessions except the given one. - void ReleaseSessionForFabricExceptOne(FabricIndex fabricIndex, const SessionHandle & exception); - void ReleaseSessionForNodeExceptOne(const ScopedNodeId & node, const SessionHandle & exception); + // This API is used by UpdateNOC command, to invalidate all sessions except the given one, whose release is deferred until + // UpdateNOC command finishing its work. + void ReleaseSessionsForFabricExceptOne(FabricIndex fabricIndex, const SessionHandle & deferred); /** * @brief