Skip to content

Commit 0a7b31f

Browse files
Reset backoff on successful subscription in MTRDevice.
ReadClient does this, but we are not using its backoff logic.
1 parent e86768b commit 0a7b31f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/darwin/Framework/CHIP/MTRDevice_Concrete.mm

+10
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ - (void)_deviceInternalStateChanged:(MTRDevice *)device;
118118
void ResetResubscriptionBackoff() { mResubscriptionNumRetries = 0; }
119119

120120
private:
121+
void OnSubscriptionEstablished(chip::SubscriptionId aSubscriptionId) override;
122+
121123
void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override;
122124

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

47714773
#pragma mark - SubscriptionCallback
47724774
namespace {
4775+
void SubscriptionCallback::OnSubscriptionEstablished(SubscriptionId aSubscriptionId)
4776+
{
4777+
// The next time we need to do a resubscribe, we should start a new backoff
4778+
// sequence.
4779+
ResetResubscriptionBackoff();
4780+
MTRBaseSubscriptionCallback::OnSubscriptionEstablished(aSubscriptionId);
4781+
}
4782+
47734783
void SubscriptionCallback::OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus)
47744784
{
47754785
if (mEventReports == nil) {

0 commit comments

Comments
 (0)