Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using controllerID for internal XPC bookkeeping. #28480

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
_controller = controllerOverXPC;
_nodeID = deviceID;
_xpcConnection = xpcConnection;
Expand Down