Skip to content

Commit

Permalink
[ICD] Subscription resumption logic should skip subscriptions created…
Browse files Browse the repository at this point in the history
… during startup wait time (#25545)

* [ICD] Subscription resumption logic should skip subscriptions created during startup wait time
  • Loading branch information
jtung-apple authored and pull[bot] committed Nov 21, 2023
1 parent 42e9ff5 commit c2a63ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app/InteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,21 @@ void InteractionModelEngine::ResumeSubscriptionsTimerCallback(System::Layer * ap
auto * iterator = imEngine->mpSubscriptionResumptionStorage->IterateSubscriptions();
while (iterator->Next(subscriptionInfo))
{
// If subscription happens between reboot and this timer callback, it's already live and should skip resumption
if (Loop::Break == imEngine->mReadHandlers.ForEachActiveObject([&](ReadHandler * handler) {
SubscriptionId subscriptionId;
handler->GetSubscriptionId(subscriptionId);
if (subscriptionId == subscriptionInfo.mSubscriptionId)
{
return Loop::Break;
}
return Loop::Continue;
}))
{
ChipLogProgress(InteractionModel, "Skip resuming live subscriptionId %" PRIu32, subscriptionInfo.mSubscriptionId);
continue;
}

auto requestedAttributePathCount = subscriptionInfo.mAttributePaths.AllocatedSize();
auto requestedEventPathCount = subscriptionInfo.mEventPaths.AllocatedSize();
if (!imEngine->EnsureResourceForSubscription(subscriptionInfo.mFabricIndex, requestedAttributePathCount,
Expand All @@ -1656,6 +1671,7 @@ void InteractionModelEngine::ResumeSubscriptionsTimerCallback(System::Layer * ap
return;
}

ChipLogProgress(InteractionModel, "Resuming subscriptionId %" PRIu32, subscriptionInfo.mSubscriptionId);
handler->ResumeSubscription(*imEngine->mpCASESessionMgr, subscriptionInfo);
}
iterator->Release();
Expand Down

0 comments on commit c2a63ad

Please sign in to comment.