Skip to content

Commit ad776f0

Browse files
authored
Select least peer active session (project-chip#36983)
1 parent 8323b1b commit ad776f0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/transport/SessionManager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1297,15 +1297,15 @@ Optional<SessionHandle> SessionManager::FindSecureSessionForNode(ScopedNodeId pe
12971297
{
12981298
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
12991299
// Set up a TCP transport based session as standby
1300-
if ((tcpSession == nullptr || tcpSession->GetLastActivityTime() < session->GetLastActivityTime()) &&
1300+
if ((tcpSession == nullptr || tcpSession->GetLastPeerActivityTime() < session->GetLastPeerActivityTime()) &&
13011301
session->GetTCPConnection() != nullptr)
13021302
{
13031303
tcpSession = session;
13041304
}
13051305
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
13061306
}
13071307

1308-
if ((mrpSession == nullptr) || (mrpSession->GetLastActivityTime() < session->GetLastActivityTime()))
1308+
if ((mrpSession == nullptr) || (mrpSession->GetLastPeerActivityTime() < session->GetLastPeerActivityTime()))
13091309
{
13101310
mrpSession = session;
13111311
}

src/transport/tests/TestSessionManager.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -998,19 +998,19 @@ TEST_F(TestSessionManager, TestFindSecureSessionForNode)
998998
CHIP_ERROR err = sessionManager.InjectCaseSessionWithTestKey(aliceToBobSession, 2, 1, aliceNodeId, bobNodeId, aliceFabricIndex,
999999
peer, CryptoContext::SessionRole::kInitiator);
10001000
EXPECT_EQ(err, CHIP_NO_ERROR);
1001-
aliceToBobSession->AsSecureSession()->MarkActive();
1001+
aliceToBobSession->AsSecureSession()->MarkActiveRx();
10021002

10031003
SessionHolder newAliceToBobSession;
10041004
err = sessionManager.InjectCaseSessionWithTestKey(newAliceToBobSession, 3, 4, aliceNodeId, bobNodeId, aliceFabricIndex, peer,
10051005
CryptoContext::SessionRole::kInitiator);
10061006
EXPECT_EQ(err, CHIP_NO_ERROR);
10071007

1008-
while (System::SystemClock().GetMonotonicTimestamp() <= aliceToBobSession->AsSecureSession()->GetLastActivityTime())
1008+
while (System::SystemClock().GetMonotonicTimestamp() <= aliceToBobSession->AsSecureSession()->GetLastPeerActivityTime())
10091009
{
10101010
// Wait for the clock to advance so the new session is
10111011
// more-recently-active.
10121012
}
1013-
newAliceToBobSession->AsSecureSession()->MarkActive();
1013+
newAliceToBobSession->AsSecureSession()->MarkActiveRx();
10141014

10151015
auto foundSession = sessionManager.FindSecureSessionForNode(ScopedNodeId(bobNodeId, aliceFabricIndex),
10161016
MakeOptional(SecureSession::Type::kCASE));

0 commit comments

Comments
 (0)