File tree 1 file changed +11
-2
lines changed
src/darwin/Framework/CHIP
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -685,13 +685,16 @@ - (void)_setDSTOffsets:(NSArray<MTRTimeSynchronizationClusterDSTOffsetStruct *>
685
685
#define MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MIN (10 * 60 ) // 10 minutes (for now)
686
686
#define MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX (60 * 60 ) // 60 minutes
687
687
688
+ -(BOOL )_subscriptionsAllowed {
689
+ return ![_deviceController isKindOfClass: MTRDeviceControllerOverXPC.class ];
690
+ }
691
+
688
692
- (void )setDelegate : (id <MTRDeviceDelegate>)delegate queue : (dispatch_queue_t )queue
689
693
{
690
694
MTR_LOG_INFO (" %@ setDelegate %@" , self, delegate);
691
695
692
696
// We should not set up a subscription for device controllers over XPC.
693
- BOOL setUpSubscription = ![_deviceController isKindOfClass: MTRDeviceControllerOverXPC.class ];
694
- ;
697
+ BOOL setUpSubscription = [self _subscriptionsAllowed ];
695
698
696
699
// For unit testing only
697
700
#ifdef DEBUG
@@ -1690,6 +1693,12 @@ - (void)_setupSubscription
1690
1693
{
1691
1694
os_unfair_lock_assert_owner (&self->_lock );
1692
1695
1696
+ if (![self _subscriptionsAllowed ])
1697
+ {
1698
+ MTR_LOG (" _setupSubscription: Subscriptions not allowed. Do not set up subscription" );
1699
+ return ;
1700
+ }
1701
+
1693
1702
#ifdef DEBUG
1694
1703
id delegate = _weakDelegate.strongObject ;
1695
1704
Optional<System::Clock::Seconds32> maxIntervalOverride;
You can’t perform that action at this time.
0 commit comments