Skip to content

Commit

Permalink
Make the logic for whether a session matches an eviction hint more re…
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and thivya-amazon committed Dec 18, 2023
1 parent 804a932 commit a74928e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/transport/SecureSessionTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ void SecureSessionTable::DefaultEvictionPolicy(EvictionPolicyContext & evictionC
// peer" state allows us to prioritize evicting defuct sessions that
// match the hint against other defunct sessions.
auto sessionMatchesEvictionHint = [&evictionContext](const SortableSession & session) -> int {
return session.mSession->GetPeer() == evictionContext.GetSessionEvictionHint() &&
(!session.mSession->IsActiveSession() || session.mNumMatchingOnPeer > 0);
if (session.mSession->GetPeer() != evictionContext.GetSessionEvictionHint())
{
return false;
}
bool isOnlyActiveSessionToPeer = session.mSession->IsActiveSession() && session.mNumMatchingOnPeer == 0;
return !isOnlyActiveSessionToPeer;
};
int doesAMatchSessionHint = sessionMatchesEvictionHint(a);
int doesBMatchSessionHint = sessionMatchesEvictionHint(b);
Expand Down

0 comments on commit a74928e

Please sign in to comment.