Skip to content

Commit 9cda649

Browse files
introduce mCatsMatchCheckIn to indicate whether cats for icd registration matched with the current subscription
1 parent 0860870 commit 9cda649

8 files changed

+16
-17
lines changed

src/app/InteractionModelEngine.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -1069,18 +1069,14 @@ void InteractionModelEngine::OnResponseTimeout(Messaging::ExchangeContext * ec)
10691069
}
10701070

10711071
#if CHIP_CONFIG_ENABLE_READ_CLIENT
1072-
void InteractionModelEngine::OnActiveModeNotification(ScopedNodeId aPeer, uint64_t aMonitoredSubject)
1072+
void InteractionModelEngine::OnActiveModeNotification(ScopedNodeId aPeer)
10731073
{
10741074
for (ReadClient * pListItem = mpActiveReadClientList; pListItem != nullptr;)
10751075
{
10761076
auto pNextItem = pListItem->GetNextClient();
10771077
// It is possible that pListItem is destroyed by the app in OnActiveModeNotification.
10781078
// Get the next item before invoking `OnActiveModeNotification`.
1079-
// If caseTag for current subscription does not match with the one set in ICDManagementCluster::RegisterClient for check-in,
1080-
// when receiving check-in message, OnActiveModeNotification would do nothing for current subscription.
1081-
if (ScopedNodeId(pListItem->GetPeerNodeId(), pListItem->GetFabricIndex()) == aPeer &&
1082-
pListItem->GetSubjectDescriptor().HasValue() && pListItem->GetSubjectDescriptor().Value().cats.CheckSubjectAgainstCATs(aMonitoredSubject) &&
1083-
pListItem->GetSubjectDescriptor().Value().subject == aMonitoredSubject)
1079+
if (ScopedNodeId(pListItem->GetPeerNodeId(), pListItem->GetFabricIndex()) == aPeer)
10841080
{
10851081
pListItem->OnActiveModeNotification();
10861082
}

src/app/InteractionModelEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
238238
*
239239
* See ReadClient::OnActiveModeNotification
240240
*/
241-
void OnActiveModeNotification(ScopedNodeId aPeer, uint64_t aMonitoredSubject);
241+
void OnActiveModeNotification(ScopedNodeId aPeer);
242242

243243
/**
244244
* Used to notify when a peer becomes LIT ICD or vice versa.

src/app/ReadClient.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ void ReadClient::OnActiveModeNotification()
490490
// called, either mEventPathParamsListSize or mAttributePathParamsListSize is not 0.
491491
VerifyOrDie(mReadPrepareParams.mEventPathParamsListSize != 0 || mReadPrepareParams.mAttributePathParamsListSize != 0);
492492

493+
// If mCatsMatchCheckIn is true, it means cats used in icd registration matches with the one in current subscription, OnActiveModeNotification
494+
// continues to revive the subscription as needed, otherwise, do nothing.
495+
VerifyOrReturn(mReadPrepareParams.mCatsMatchCheckIn);
496+
493497
// When we reach here, the subscription definitely exceeded the liveness timeout. Just continue the unfinished resubscription
494498
// logic in `OnLivenessTimeoutCallback`.
495499
if (IsInactiveICDSubscription())

src/app/ReadClient.h

-6
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,6 @@ class ReadClient : public Messaging::ExchangeDelegate
509509
*/
510510
Optional<System::Clock::Timeout> GetSubscriptionTimeout();
511511

512-
Optional<Access::SubjectDescriptor> GetSubjectDescriptor() const
513-
{
514-
VerifyOrReturnValue(mReadPrepareParams.mSessionHolder, NullOptional);
515-
return MakeOptional(mReadPrepareParams.mSessionHolder->AsSecureSession()->GetSubjectDescriptor());
516-
}
517-
518512
private:
519513
friend class TestReadInteraction;
520514
friend class InteractionModelEngine;

src/app/ReadPrepareParams.h

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ struct ReadPrepareParams
4949
bool mIsFabricFiltered = true;
5050
bool mIsPeerLIT = false;
5151

52+
// see ReadClient::OnActiveModeNotification
53+
bool mCatsMatchCheckIn = true;
54+
5255
ReadPrepareParams() {}
5356
ReadPrepareParams(const SessionHandle & sessionHandle) { mSessionHolder.Grab(sessionHandle); }
5457
ReadPrepareParams(ReadPrepareParams && other) : mSessionHolder(other.mSessionHolder)
@@ -66,6 +69,7 @@ struct ReadPrepareParams
6669
mTimeout = other.mTimeout;
6770
mIsFabricFiltered = other.mIsFabricFiltered;
6871
mIsPeerLIT = other.mIsPeerLIT;
72+
mCatsMatchCheckIn = other.mCatsMatchCheckIn;
6973
other.mpEventPathParamsList = nullptr;
7074
other.mEventPathParamsListSize = 0;
7175
other.mpAttributePathParamsList = nullptr;
@@ -91,6 +95,7 @@ struct ReadPrepareParams
9195
mTimeout = other.mTimeout;
9296
mIsFabricFiltered = other.mIsFabricFiltered;
9397
mIsPeerLIT = other.mIsPeerLIT;
98+
mCatsMatchCheckIn = other.mCatsMatchCheckIn;
9499
other.mpEventPathParamsList = nullptr;
95100
other.mEventPathParamsListSize = 0;
96101
other.mpAttributePathParamsList = nullptr;

src/app/icd/client/CheckInHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ CHIP_ERROR CheckInHandler::OnMessageReceived(Messaging::ExchangeContext * ec, co
138138
mpICDClientStorage->StoreEntry(clientInfo);
139139
mpCheckInDelegate->OnCheckInComplete(clientInfo);
140140
#if CHIP_CONFIG_ENABLE_READ_CLIENT
141-
mpImEngine->OnActiveModeNotification(clientInfo.peer_node, clientInfo.monitored_subject);
141+
mpImEngine->OnActiveModeNotification(clientInfo.peer_node);
142142
#endif // CHIP_CONFIG_ENABLE_READ_CLIENT
143143
}
144144

src/app/icd/client/RefreshKeySender.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ CHIP_ERROR RefreshKeySender::RegisterClientWithNewKey(Messaging::ExchangeManager
6969

7070
mpCheckInDelegate->OnCheckInComplete(mICDClientInfo);
7171
#if CHIP_CONFIG_ENABLE_READ_CLIENT
72-
mpImEngine->OnActiveModeNotification(mICDClientInfo.peer_node, mICDClientInfo.monitored_subject);
72+
mpImEngine->OnActiveModeNotification(mICDClientInfo.peer_node);
7373
#endif // CHIP_CONFIG_ENABLE_READ_CLIENT
7474
mpCheckInDelegate->OnKeyRefreshDone(this, CHIP_NO_ERROR);
7575
};

src/controller/tests/data_model/TestRead.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2330,7 +2330,7 @@ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification)
23302330
GetLoopback().mNumMessagesToDrop = 0;
23312331
callback.ClearCounters();
23322332
InteractionModelEngine::GetInstance()->OnActiveModeNotification(
2333-
ScopedNodeId(readClient.GetPeerNodeId(), readClient.GetFabricIndex()), readClient.GetSubjectDescriptor().Value().subject);
2333+
ScopedNodeId(readClient.GetPeerNodeId(), readClient.GetFabricIndex()));
23342334
EXPECT_EQ(callback.mOnResubscriptionsAttempted, 1);
23352335
EXPECT_EQ(callback.mLastError, CHIP_ERROR_TIMEOUT);
23362336

@@ -2393,7 +2393,7 @@ TEST_F(TestRead, TestSubscribeFailed_OnActiveModeNotification)
23932393
GetLoopback().mNumMessagesToDrop = 0;
23942394
callback.ClearCounters();
23952395
InteractionModelEngine::GetInstance()->OnActiveModeNotification(
2396-
ScopedNodeId(readClient.GetPeerNodeId(), readClient.GetFabricIndex()), readClient.GetSubjectDescriptor().Value().subject);
2396+
ScopedNodeId(readClient.GetPeerNodeId(), readClient.GetFabricIndex()));
23972397
//
23982398
// Drive servicing IO till we have established a subscription.
23992399
//

0 commit comments

Comments
 (0)