diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index d93a379ae3538f..157a38199f025e 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -67,8 +67,16 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)]; self.xpcConnection.exportedObject = self; - MTR_LOG("Resuming new XPC connection"); - [self.xpcConnection resume]; + self.xpcConnection.interruptionHandler = ^{ + MTR_LOG_ERROR("XPC Connection for device controller interrupted: %@", UUID); + }; + + self.xpcConnection.invalidationHandler = ^{ + MTR_LOG_ERROR("XPC Connection for device controller invalidated: %@", UUID); + }; + + MTR_LOG("Activating new XPC connection"); + [self.xpcConnection activate]; } else { MTR_LOG_ERROR("Failed to set up XPC Connection"); return nil; diff --git a/src/platform/Darwin/DnssdContexts.cpp b/src/platform/Darwin/DnssdContexts.cpp index 4e88df40ee596d..ff869911e98e48 100644 --- a/src/platform/Darwin/DnssdContexts.cpp +++ b/src/platform/Darwin/DnssdContexts.cpp @@ -247,6 +247,7 @@ void MdnsContexts::Delete(GenericContext * context) if (context->serviceRef != nullptr) { DNSServiceRefDeallocate(context->serviceRef); + context->serviceRef = nullptr; } chip::Platform::Delete(context); }