forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit 9bcc564
committed
Remove subscription establishment bits from the MTRDevice base class.
_setupSubscriptionWithReason was only called from
_reattemptSubscriptionNowIfNeededWithReason.
_reattemptSubscriptionNowIfNeededWithReason was only called from:
* _handleUnsolicitedMessageFromPublisher, which is only called in callbacks set
up by _setupSubscriptionWithReason.
* _triggerResubscribeWithReason, which only calls it when
_reattemptingSubscription is YES. But that's only set to YES in
_doHandleSubscriptionReset, see next item.
* _doHandleSubscriptionReset, called from:
* _handleSubscriptionReset: only called from callbacks set up by
_setupSubscriptionWithReason.
* _resetSubscriptionWithReasonString: called from unitTestResetSubscription
and us detecting persisted data corruption in _clusterDataForPath. But we
don't actually have persisted data in the MTRDevice base class anymore, so
that's not reachable.
So _setupSubscriptionWithReason is not reachable and can be removed. And
unitTestResetSubscription can be made a no-op on the base MTRDevice. And we can
remove the _resetSubscriptionWithReasonString call in _clusterDataForPath.
Once those are done, the following become unreachable:
* _handleSubscriptionReset
* _handleSubscriptionError
* Writing a nonzero value to _unitTestAttributesReportedSinceLastCheck
* _markDeviceAsUnreachableIfNeverSubscribed
* _handleResubscriptionNeededWithDelay
* _handleSubscriptionEstablished
* _handleUnsolicitedMessageFromPublisher
* _createDataVersionFilterListFromDictionary
* _setupConnectivityMonitoring
* _resetSubscriptionWithReasonString
Once those have been removed, the following become unreachable:
* HadSubscriptionEstablishedOnce
* _stopConnectivityMonitoring
* _doHandleSubscriptionError
* _doHandleSubscriptionReset
Once those have been removed, the following become unreachable:
* _setLastSubscriptionAttemptWait
* Setting _lastSubscriptionFailureTime to non-nil
* _clearSubscriptionPoolWork
* _scheduleSubscriptionPoolWork
* Use of _initialSubscribeStart
* _storePersistedDeviceData
* Use of _connectivityMonitor
* Use of _lastSubscriptionFailureTimeForDescription
* Any code depending on reattemptingSubscription being YES.
* Use of _lastSubscriptionAttemptWait
* Use of _lastSubscriptionAttemptWaitForDescription
Once those have been removed, _reattemptSubscriptionNowIfNeededWithReason is
unreachable and can be removed.
At this point _currentReadClient and _currentSubscriptionCallback are always
nil, so all code conditioned on those can be removed. Once that's done,
_triggerResubscribeWithReason is a no-op, so it and all calls to it can be
removed.
Since _lastSubscriptionFailureTime is always nil, all code guarded on it not
being nil can be removed, so _readThroughSkipped becomes a no-op and
_lastSubscriptionFailureTime can be removed.
At this point, the following are not reachable:
* NeedToStartSubscriptionSetup
* _changeInternalState
Once those are removed, _internalDeviceStateForDescription is unused, and
_internalDeviceState is always MTRInternalDeviceStateUnsubscribed. So
HaveSubscriptionEstablishedRightNow() always returns NO and can be removed.
At this point SubscriptionCallback is unused and can also be removed.1 parent 3cdef41 commit 9bcc564Copy full SHA for 9bcc564
1 file changed
+4
-1040
lines changed
0 commit comments