Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjerryjohns committed Jun 20, 2022
1 parent 78aeb93 commit 7b47497
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/tests/suites/certification/Test_TC_WNCV_4_5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ tests:
arguments:
values:
- name: "ms"
value: 500
value: 1000

- label: "1c: TH sends StopMotion command to DUT"
command: "StopMotion"
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ ExchangeContext::~ExchangeContext()
VerifyOrDie(!IsAckPending());

if (ReleaseSessionOnDestruction() && mSession)
mSession->AsSecureSession()->MarkForRemoval();
mSession->AsSecureSession()->MarkForEviction();

#if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED
// Make sure that the exchange withdraws the request for Sleepy End Device active mode.
Expand Down
12 changes: 10 additions & 2 deletions src/transport/SecureSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ void SecureSession::MarkAsDefunct()
//
return;

case State::kInactive:
//
// Once a session is marked Inactive, we CANNOT bring it back to either being active or defunct.
//
FALLTHROUGH;
case State::kPendingEviction:
//
// Once a session is headed for eviction, we CANNOT bring it back to either being active or defunct.
Expand All @@ -113,6 +118,7 @@ void SecureSession::MarkForEviction()
case State::kDefunct:
FALLTHROUGH;
case State::kActive:
FALLTHROUGH;
case State::kInactive:
Release(); // Decrease the ref which is retained at Activate
MoveToState(State::kPendingEviction);
Expand All @@ -132,15 +138,17 @@ void SecureSession::MarkInactive()
ReferenceCountedHandle<Transport::Session> ref(*this);
switch (mState)
{
case State::kPairing:
case State::kEstablishing:
VerifyOrDie(false);
return;
case State::kDefunct:
FALLTHROUGH;
case State::kActive:
// By setting this state, IsActiveSession() will return false, which prevents creating new exchanges.
mState = State::kInactive;
return;
case State::kInactive:
case State::kPendingRemoval:
case State::kPendingEviction:
// Do nothing
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/transport/SecureSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
// In addition to any existing SessionHolders holding a reference to this session, the SessionManager
// maintains a reference as well to the session that will only be relinquished when MarkForEviction is called.
//
kDefunct = 4,
kDefunct = 3,

//
// The session has been marked for eviction and is pending deallocation. All SessionHolders would have already
Expand All @@ -306,14 +306,14 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
//
// When all SessionHandles go out of scope, the session will be released automatically.
//
kPendingEviction = 3,
kPendingEviction = 4,

//
// The session is still functional but it can't yield any new outbound or inbound exchanges.
// This is meant to be used in conjunction with ExchangeManager::AbortExchangesForFabricExceptOne, with the one
// exceptional exchange handling out of this state when it finishes whatever it needs the session for.
//
kInactive = 4,
kInactive = 5,
};

const char * StateToString(State state) const;
Expand Down
2 changes: 1 addition & 1 deletion src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void SessionManager::ReleaseSessionsForFabricExceptOne(FabricIndex fabricIndex,
if (session == deferredSecureSession)
session->MarkInactive();
else
session->MarkForRemoval();
session->MarkForEviction();
}
return Loop::Continue;
});
Expand Down

0 comments on commit 7b47497

Please sign in to comment.