Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to do something with message delivery failures on other fabrics. #16157

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,34 @@ CHIP_ERROR DeviceController::DisconnectDevice(NodeId nodeId)

void DeviceController::OnFirstMessageDeliveryFailed(const SessionHandle & session)
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
{
VerifyOrReturn(mState == State::Initialized,
ChipLogError(Controller, "OnFirstMessageDeliveryFailed was called in incorrect state"));
VerifyOrReturn(session->GetSessionType() == Transport::Session::SessionType::kSecure);
CHIP_ERROR err = UpdateDevice(session->AsSecureSession()->GetPeerNodeId());
if (session->GetSessionType() != Session::SessionType::kSecure)
{
// Definitely not a CASE session.
return;
}

auto * secureSession = session->AsSecureSession();
if (secureSession->GetSecureSessionType() != SecureSession::Type::kCASE)
{
// Still not CASE.
return;
}

FabricIndex ourIndex = kUndefinedFabricIndex;
CHIP_ERROR err = GetFabricIndex(&ourIndex);
if (err != CHIP_NO_ERROR)
{
// We can't really do CASE, now can we?
return;
}

if (ourIndex != session->GetFabricIndex())
{
// Not one of our sessions.
return;
}

err = UpdateDevice(secureSession->GetPeerNodeId());
if (err != CHIP_NO_ERROR)
{
ChipLogError(Controller,
Expand Down
3 changes: 2 additions & 1 deletion src/transport/SessionDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class DLL_EXPORT SessionRecoveryDelegate
* Called when the first message delivery in a session failed,
* so actions aiming to recover connection can be performed.
*
* @param session The handle to the secure session
* @param session The handle to the session. This may be any session type
* that supports MRP.
*/
virtual void OnFirstMessageDeliveryFailed(const SessionHandle & session) = 0;
};
Expand Down