From cfa8212524abc934c5b5e6cea35ea400e24dc3f1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 2 Aug 2023 19:27:21 -0400 Subject: [PATCH] Stop using controllerID for internal XPC bookkeeping. (#28480) We want to use controllerID for client-assigned controller IDs. --- .../Framework/CHIP/MTRDeviceControllerOverXPC.mm | 10 +++++----- .../CHIP/MTRDeviceControllerOverXPC_Internal.h | 2 +- src/darwin/Framework/CHIP/MTRDeviceOverXPC.mm | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.mm index 844c7d26e7c63a..674618a5eb9987 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.mm @@ -179,7 +179,7 @@ - (void)fetchControllerIdWithQueue:(dispatch_queue_t)queue completion:(MTRFetchC dispatch_async(_workQueue, ^{ dispatch_group_t group = dispatch_group_create(); - if (!self.controllerID) { + if (!self.controllerXPCID) { dispatch_group_enter(group); [self.xpcConnection getProxyHandleWithCompletion:^( dispatch_queue_t _Nonnull proxyQueue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) { @@ -188,7 +188,7 @@ - (void)fetchControllerIdWithQueue:(dispatch_queue_t)queue completion:(MTRFetchC if (error) { MTR_LOG_ERROR("Failed to fetch any shared remote controller"); } else { - self.controllerID = controller; + self.controllerXPCID = controller; handleRetainer = handle; } dispatch_group_leave(group); @@ -200,8 +200,8 @@ - (void)fetchControllerIdWithQueue:(dispatch_queue_t)queue completion:(MTRFetchC }]; } dispatch_group_notify(group, queue, ^{ - if (self.controllerID) { - completion(self.controllerID, handleRetainer, nil); + if (self.controllerXPCID) { + completion(self.controllerXPCID, handleRetainer, nil); } else { completion(nil, nil, [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeGeneralError userInfo:nil]); } @@ -234,7 +234,7 @@ - (instancetype)initWithControllerID:(id)controllerID workQueue:(dispatch_queue_t)queue xpcConnection:(MTRDeviceControllerXPCConnection *)xpcConnection { - _controllerID = controllerID; + _controllerXPCID = controllerID; _workQueue = queue; _xpcConnection = xpcConnection; return self; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC_Internal.h index ccbc2f29168450..b4d498b29295c0 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC_Internal.h @@ -25,7 +25,7 @@ typedef void (^MTRFetchControllerIDCompletion)( @interface MTRDeviceControllerOverXPC () -@property (nonatomic, readwrite, strong) id _Nullable controllerID; +@property (nonatomic, readwrite, strong) id _Nullable controllerXPCID; @property (nonatomic, readonly, strong) dispatch_queue_t workQueue; @property (nonatomic, readonly, strong) MTRDeviceControllerXPCConnection * xpcConnection; diff --git a/src/darwin/Framework/CHIP/MTRDeviceOverXPC.mm b/src/darwin/Framework/CHIP/MTRDeviceOverXPC.mm index cdc2dacb20c37c..98a217eb77e2d8 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceOverXPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceOverXPC.mm @@ -46,7 +46,7 @@ - (instancetype)initWithControllerOverXPC:(MTRDeviceControllerOverXPC *)controll deviceID:(NSNumber *)deviceID xpcConnection:(MTRDeviceControllerXPCConnection *)xpcConnection { - _controllerID = controllerOverXPC.controllerID; + _controllerID = controllerOverXPC.controllerXPCID; _controller = controllerOverXPC; _nodeID = deviceID; _xpcConnection = xpcConnection;