Skip to content

Commit 059658e

Browse files
Trigger resubscription when receiving check-in and subscription has not yet become abnoaml in client
1 parent 649c341 commit 059658e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/app/ReadClient.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ CHIP_ERROR ReadClient::GenerateDataVersionFilterList(DataVersionFilterIBs::Build
484484

485485
void ReadClient::OnActiveModeNotification()
486486
{
487+
// Note: this API only works when issuing subscription via SendAutoResubscribeRequest.
487488
VerifyOrDie(mpImEngine->InActiveReadClientList(this));
488489
// When we reach here, the subscription definitely exceeded the liveness timeout. Just continue the unfinished resubscription
489490
// logic in `OnLivenessTimeoutCallback`.
@@ -493,6 +494,18 @@ void ReadClient::OnActiveModeNotification()
493494
return;
494495
}
495496

497+
// If the server sends out check-in message, and there is no reschedule subscription yet in client side at the same time, it means
498+
// current client does not realize subscription has gone, and we should forcibly timeout current subscription, and schedule a new one.
499+
if (!mIsResubscriptionScheduled)
500+
{
501+
// Closing will ultimately trigger ScheduleResubscription with the aReestablishCASE argument set to true, effectively
502+
// rendering the session defunct.
503+
Close(CHIP_ERROR_TIMEOUT);
504+
return;
505+
}
506+
507+
// If the server sends a check-in message and a subscription is already scheduled, it indicates a client-side subscription timeout or failure.
508+
// Cancel the scheduled subscription and initiate a new one immediately.
496509
TriggerResubscribeIfScheduled("check-in message");
497510
}
498511

0 commit comments

Comments
 (0)