Skip to content

Commit 0eed745

Browse files
address comments
1 parent 6da3d6e commit 0eed745

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

src/app/InteractionModelEngine.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
236236
/**
237237
* Activate the idle subscriptions.
238238
*
239-
* When subscribing to ICD and liveness timeout reached, the read client will move to `InactiveICDSubscription` state and
240-
* resubscription can be triggered via OnActiveModeNotification().
239+
* See ReadClient::OnActiveModeNotification
241240
*/
242241
void OnActiveModeNotification(ScopedNodeId aPeer);
243242

src/app/ReadClient.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,12 @@ CHIP_ERROR ReadClient::GenerateDataVersionFilterList(DataVersionFilterIBs::Build
484484

485485
void ReadClient::OnActiveModeNotification()
486486
{
487-
// Note: this API only works when issuing subscription via SendAutoResubscribeRequest.
488487
VerifyOrDie(mpImEngine->InActiveReadClientList(this));
488+
489+
// Note: this API only works when issuing subscription via SendAutoResubscribeRequest, when SendAutoResubscribeRequest is
490+
// called, either mEventPathParamsListSize or mAttributePathParamsListSize is not 0.
491+
VerifyOrDie(mReadPrepareParams.mEventPathParamsListSize != 0 || mReadPrepareParams.mAttributePathParamsListSize != 0);
492+
489493
// When we reach here, the subscription definitely exceeded the liveness timeout. Just continue the unfinished resubscription
490494
// logic in `OnLivenessTimeoutCallback`.
491495
if (IsInactiveICDSubscription())
@@ -494,18 +498,19 @@ void ReadClient::OnActiveModeNotification()
494498
return;
495499
}
496500

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.
501+
// If the server sends out check-in message, and there is no reschedule subscription yet in client side at the same time, it
502+
// means current client does not realize subscription has gone, and we should forcibly timeout current subscription, and
503+
// schedule a new one.
499504
if (!mIsResubscriptionScheduled)
500505
{
501-
// Closing will ultimately trigger ScheduleResubscription with the aReestablishCASE argument set to true, effectively
506+
// Closing will ultimately trigger ScheduleResubscription with the aReestablishCASE argument set to true, effectively
502507
// rendering the session defunct.
503508
Close(CHIP_ERROR_TIMEOUT);
504509
return;
505510
}
506511

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.
512+
// If the server sends a check-in message and a subscription is already scheduled, it indicates a client-side subscription
513+
// timeout or failure. Cancel the scheduled subscription and initiate a new one immediately.
509514
TriggerResubscribeIfScheduled("check-in message");
510515
}
511516

src/app/ReadClient.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,17 @@ class ReadClient : public Messaging::ExchangeDelegate
351351
* Re-activate an inactive subscription.
352352
*
353353
* When subscribing to LIT-ICD and liveness timeout reached and OnResubscriptionNeeded returns
354-
* CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT, the read client will move to the InactiveICDSubscription state and
355-
* resubscription can be triggered via OnActiveModeNotification().
354+
* CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT, the read client will move to the InactiveICDSubscription state and
355+
* resubscription can be triggered via OnActiveModeNotification().
356356
*
357357
* If the subscription is not in the `InactiveICDSubscription` state, this function will do nothing. So it is always safe to
358-
* call this function when a check-in message is received.
358+
* call this function when a check-in message is received.
359+
*
360+
* If the server sends out check-in message, and there is no reschedule subscription yet in client side at the same time, it
361+
* means current client does not realize subscription has gone, and we should forcibly timeout current subscription, and
362+
* schedule a new one.
363+
*
364+
* This API only works when issuing subscription via SendAutoResubscribeRequest.
359365
*/
360366
void OnActiveModeNotification();
361367

0 commit comments

Comments
 (0)