Skip to content

Commit 294119d

Browse files
Resubscribe when check-in is received and it is not in inactive state
1 parent 28c1d83 commit 294119d

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/app/ReadClient.cpp

+15-5
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,24 @@ CHIP_ERROR ReadClient::GenerateDataVersionFilterList(DataVersionFilterIBs::Build
484484

485485
void ReadClient::OnActiveModeNotification()
486486
{
487-
// This function just tries to complete the deferred resubscription logic in `OnLivenessTimeoutCallback`.
488487
VerifyOrDie(mpImEngine->InActiveReadClientList(this));
489-
// If we are not in InactiveICDSubscription state, that means the liveness timeout has not been reached. Simply do nothing.
490-
VerifyOrReturn(IsInactiveICDSubscription());
491-
492488
// When we reach here, the subscription definitely exceeded the liveness timeout. Just continue the unfinished resubscription
493489
// logic in `OnLivenessTimeoutCallback`.
494-
TriggerResubscriptionForLivenessTimeout(CHIP_ERROR_TIMEOUT);
490+
if (IsInactiveICDSubscription())
491+
{
492+
TriggerResubscriptionForLivenessTimeout(CHIP_ERROR_TIMEOUT);
493+
return;
494+
}
495+
496+
if (mIsResubscriptionScheduled)
497+
{
498+
// If a subscription fails and resubscription is scheduled, a check-in message should cancel
499+
// the pending resubscription and initiate a new subscription immediately."
500+
mNumRetries = 0;
501+
CancelResubscribeTimer();
502+
TriggerResubscriptionForLivenessTimeout(CHIP_ERROR_TIMEOUT);
503+
}
504+
return;
495505
}
496506

497507
void ReadClient::OnPeerTypeChange(PeerType aType)

0 commit comments

Comments
 (0)