Skip to content

Commit

Permalink
Stop using controllerID for internal XPC bookkeeping. (#28480)
Browse files Browse the repository at this point in the history
We want to use controllerID for client-assigned controller IDs.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Dec 18, 2023
1 parent f0c4bc5 commit 9845c68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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]);
}
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef void (^MTRFetchControllerIDCompletion)(

@interface MTRDeviceControllerOverXPC ()

@property (nonatomic, readwrite, strong) id<NSCopying> _Nullable controllerID;
@property (nonatomic, readwrite, strong) id<NSCopying> _Nullable controllerXPCID;
@property (nonatomic, readonly, strong) dispatch_queue_t workQueue;
@property (nonatomic, readonly, strong) MTRDeviceControllerXPCConnection * xpcConnection;

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRDeviceOverXPC.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9845c68

Please sign in to comment.