Skip to content

Commit

Permalink
[Darwin] Fix MTRDeviceConnectivityMonitor DNSServiceRefDeallocate cal…
Browse files Browse the repository at this point in the history
…l on the correct queue
  • Loading branch information
jtung-apple committed May 12, 2024
1 parent d1d0d2b commit 45f2993
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@ - (void)_stopMonitoring

- (void)stopMonitoring
{
MTR_LOG_INFO("%@ stop connectivity monitoring for %@", self, _instanceName);
std::lock_guard lock(sConnectivityMonitorLock);
[self _stopMonitoring];
// DNSServiceRefDeallocate must be called on the same queue set on the shared connection.
dispatch_async(sSharedResolverQueue, ^{
MTR_LOG_INFO("%@ stop connectivity monitoring for %@", self, self->_instanceName);
std::lock_guard lock(sConnectivityMonitorLock);
[self _stopMonitoring];
});
}
@end

0 comments on commit 45f2993

Please sign in to comment.