Skip to content

Commit

Permalink
[Darwin] Subscription pool logging should note associated device (pro…
Browse files Browse the repository at this point in the history
  • Loading branch information
jtung-apple authored Dec 10, 2024
1 parent f6163e4 commit 918320e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/darwin/Framework/CHIP/MTRDevice_Concrete.mm
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ - (void)_ensureSubscriptionForExistingDelegates:(NSString *)reason
if ([self _deviceUsesThread]) {
MTR_LOG(" => %@ - device is a thread device, scheduling in pool", self);
mtr_weakify(self);
NSString * description = [NSString stringWithFormat:@"MTRDevice setDelegate first subscription / controller resume (%p)", self];
[self _scheduleSubscriptionPoolWork:^{
mtr_strongify(self);
VerifyOrReturn(self);
Expand All @@ -827,7 +828,7 @@ - (void)_ensureSubscriptionForExistingDelegates:(NSString *)reason
std::lock_guard lock(self->_lock);
[self _clearSubscriptionPoolWork];
}];
} inNanoseconds:0 description:@"MTRDevice setDelegate first subscription"];
} inNanoseconds:0 description:description];
} else {
[_deviceController asyncDispatchToMatterQueue:^{
std::lock_guard lock(self->_lock);
Expand Down Expand Up @@ -1350,7 +1351,8 @@ - (void)_handleResubscriptionNeededWithDelayOnDeviceQueue:(NSNumber *)resubscrip
if (deviceUsesThread) {
std::lock_guard lock(_lock);
// For Thread-enabled devices, schedule the _triggerResubscribeWithReason call to run in the subscription pool
[self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:@"ReadClient resubscription"];
NSString * description = [NSString stringWithFormat:@"ReadClient resubscription (%p)", self];
[self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:description];
} else {
// For non-Thread-enabled devices, just call the resubscription block after the specified time
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, resubscriptionDelayNs), self.queue, resubscriptionBlock);
Expand Down Expand Up @@ -1467,7 +1469,8 @@ - (void)_doHandleSubscriptionReset:(NSNumber * _Nullable)retryDelay
int64_t resubscriptionDelayNs = static_cast<int64_t>(secondsToWait * NSEC_PER_SEC);
if ([self _deviceUsesThread]) {
// For Thread-enabled devices, schedule the _reattemptSubscriptionNowIfNeededWithReason call to run in the subscription pool
[self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:@"MTRDevice resubscription"];
NSString * description = [NSString stringWithFormat:@"MTRDevice resubscription (%p)", self];
[self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:description];
} else {
// For non-Thread-enabled devices, just call the resubscription block after the specified time
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, resubscriptionDelayNs), self.queue, resubscriptionBlock);
Expand Down

0 comments on commit 918320e

Please sign in to comment.