From ad09dd86d43d82378e9ddf93eafe2b7648523d6d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 31 Aug 2022 17:58:02 -0400 Subject: [PATCH 1/2] Only do address updates for CASE delivery failures. When the handling of "failed to send message, so update the IP for this peer" moved out of DeviceCommissioner, we stopped checking whether the session is a CASE session. Go back to checking that again. Fixes https://github.com/project-chip/connectedhomeip/issues/22326 --- src/app/OperationalSessionSetup.cpp | 2 +- src/messaging/ReliableMessageMgr.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/OperationalSessionSetup.cpp b/src/app/OperationalSessionSetup.cpp index 3a0d124297a091..c7de01fb036422 100644 --- a/src/app/OperationalSessionSetup.cpp +++ b/src/app/OperationalSessionSetup.cpp @@ -411,7 +411,7 @@ void OperationalSessionSetup::PerformAddressUpdate() CHIP_ERROR err = LookupPeerAddress(); if (err != CHIP_NO_ERROR) { - ChipLogError(Controller, "PerformAddressUpdate could not perform lookup"); + ChipLogError(Controller, "PerformAddressUpdate could not perform lookup: %" CHIP_ERROR_FORMAT, err.Format()); DequeueConnectionCallbacks(err); // Do not touch `this` instance anymore; it has been destroyed in DequeueConnectionCallbacks. return; diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp index d37c186d3daf3a..b5c35731ac95de 100644 --- a/src/messaging/ReliableMessageMgr.cpp +++ b/src/messaging/ReliableMessageMgr.cpp @@ -320,7 +320,8 @@ CHIP_ERROR ReliableMessageMgr::SendFromRetransTable(RetransTableEntry * entry) if (exchangeMgr) { // After the first failure notify session manager to refresh device data - if (entry->sendCount == 1 && mSessionUpdateDelegate != nullptr) + if (entry->sendCount == 1 && mSessionUpdateDelegate != nullptr && entry->ec->GetSessionHandle()->IsSecureSession() && + entry->ec->GetSessionHandle()->AsSecureSession()->IsCASESession()) { mSessionUpdateDelegate->UpdatePeerAddress(entry->ec->GetSessionHandle()->GetPeer()); } From ade7178682b755bfb3ed7c8c036adf34f3512e34 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 1 Sep 2022 09:33:14 -0400 Subject: [PATCH 2/2] Address review comment. --- src/app/OperationalSessionSetup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/OperationalSessionSetup.cpp b/src/app/OperationalSessionSetup.cpp index c7de01fb036422..38aa12566c59b8 100644 --- a/src/app/OperationalSessionSetup.cpp +++ b/src/app/OperationalSessionSetup.cpp @@ -411,7 +411,7 @@ void OperationalSessionSetup::PerformAddressUpdate() CHIP_ERROR err = LookupPeerAddress(); if (err != CHIP_NO_ERROR) { - ChipLogError(Controller, "PerformAddressUpdate could not perform lookup: %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Controller, "Failed to look up peer address: %" CHIP_ERROR_FORMAT, err.Format()); DequeueConnectionCallbacks(err); // Do not touch `this` instance anymore; it has been destroyed in DequeueConnectionCallbacks. return;