Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset backoff on successful subscription in MTRDevice. #37503

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ class MTRBaseSubscriptionCallback : public chip::app::ClusterStateCache::Callbac

void OnDeallocatePaths(chip::app::ReadPrepareParams && aReadPrepareParams) override;

void OnSubscriptionEstablished(chip::SubscriptionId aSubscriptionId) override;

CHIP_ERROR OnResubscriptionNeeded(chip::app::ReadClient * apReadClient, CHIP_ERROR aTerminationCause) override;

void OnUnsolicitedMessageFromPublisher(chip::app::ReadClient * apReadClient) override;
Expand All @@ -153,6 +151,8 @@ class MTRBaseSubscriptionCallback : public chip::app::ClusterStateCache::Callbac

void CallResubscriptionScheduledHandler(NSError * error, NSNumber * resubscriptionDelay);

void OnSubscriptionEstablished(chip::SubscriptionId aSubscriptionId) override;

private:
DataReportCallback _Nullable mAttributeReportCallback = nil;
DataReportCallback _Nullable mEventReportCallback = nil;
Expand Down
10 changes: 10 additions & 0 deletions src/darwin/Framework/CHIP/MTRDevice_Concrete.mm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ - (void)_deviceInternalStateChanged:(MTRDevice *)device;
void ResetResubscriptionBackoff() { mResubscriptionNumRetries = 0; }

private:
void OnSubscriptionEstablished(chip::SubscriptionId aSubscriptionId) override;

void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override;

void OnAttributeData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) override;
Expand Down Expand Up @@ -4770,6 +4772,14 @@ + (MTRDevice *)deviceWithNodeID:(uint64_t)nodeID deviceController:(MTRDeviceCont

#pragma mark - SubscriptionCallback
namespace {
void SubscriptionCallback::OnSubscriptionEstablished(SubscriptionId aSubscriptionId)
{
// The next time we need to do a resubscribe, we should start a new backoff
// sequence.
ResetResubscriptionBackoff();
MTRBaseSubscriptionCallback::OnSubscriptionEstablished(aSubscriptionId);
}

void SubscriptionCallback::OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus)
{
if (mEventReports == nil) {
Expand Down
Loading