Skip to content

Commit d38d56b

Browse files
authored
[Matter.framework] Remove the MTRDeviceController_Concrete::invalidateCASESessionEstablishmentForNode API and move the code inside MTRDevice_Concrete instead (#36315)
1 parent f212d60 commit d38d56b

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h

-6
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,6 @@ NS_ASSUME_NONNULL_BEGIN
178178
*/
179179
- (void)invalidateCASESessionForNode:(NSNumber *)nodeID;
180180

181-
/**
182-
* Invalidate the CASE session establishment for the specified node ID.
183-
* Must not be called on the Matter event queue.
184-
*/
185-
- (void)invalidateCASESessionEstablishmentForNode:(NSNumber *)nodeID;
186-
187181
/**
188182
* Download log of the desired type from the device.
189183
*/

src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm

-11
Original file line numberDiff line numberDiff line change
@@ -1619,17 +1619,6 @@ - (void)invalidateCASESessionForNode:(NSNumber *)nodeID;
16191619
[self syncRunOnWorkQueue:block error:nil];
16201620
}
16211621

1622-
- (void)invalidateCASESessionEstablishmentForNode:(NSNumber *)nodeID;
1623-
{
1624-
auto block = ^{
1625-
auto caseSessionMgr = self->_cppCommissioner->CASESessionMgr();
1626-
VerifyOrDie(caseSessionMgr != nullptr);
1627-
caseSessionMgr->ReleaseSession(self->_cppCommissioner->GetPeerScopedId(nodeID.unsignedLongLongValue));
1628-
};
1629-
1630-
[self syncRunOnWorkQueue:block error:nil];
1631-
}
1632-
16331622
- (void)operationalInstanceAdded:(NSNumber *)nodeID
16341623
{
16351624
// Don't use deviceForNodeID here, because we don't want to create the

src/darwin/Framework/CHIP/MTRDevice_Concrete.mm

+5-3
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,11 @@ - (void)_triggerResubscribeWithReason:(NSString *)reason nodeLikelyReachable:(BO
901901
} else if (_internalDeviceState == MTRInternalDeviceStateSubscribing && nodeLikelyReachable) {
902902
// If we have reason to suspect that the node is now reachable and we haven’t established a
903903
// CASE session yet, let’s consider it to be stalled and invalidate the pairing session.
904-
dispatch_async(self.queue, ^{
905-
[[self _concreteController] invalidateCASESessionEstablishmentForNode:self->_nodeID];
906-
});
904+
[[self _concreteController] asyncGetCommissionerOnMatterQueue:^(Controller::DeviceCommissioner * commissioner) {
905+
auto caseSessionMgr = commissioner->CASESessionMgr();
906+
VerifyOrDie(caseSessionMgr != nullptr);
907+
caseSessionMgr->ReleaseSession(commissioner->GetPeerScopedId(self->_nodeID.unsignedLongLongValue));
908+
} errorHandler:nil /* not much we can do */];
907909
}
908910
}
909911

0 commit comments

Comments
 (0)