@@ -339,105 +339,6 @@ - (void)shutdown
339
339
MTR_ABSTRACT_METHOD ();
340
340
}
341
341
342
- // Clean up from a state where startup was called.
343
- - (void )cleanupAfterStartup
344
- {
345
- // Invalidate our MTRDevice instances before we shut down our secure
346
- // sessions and whatnot, so they don't start trying to resubscribe when we
347
- // do the secure session shutdowns. Since we don't want to hold the lock
348
- // while calling out into arbitrary invalidation code, snapshot the list of
349
- // devices before we start invalidating.
350
- MTR_LOG (" %s: %@" , __PRETTY_FUNCTION__, self);
351
- os_unfair_lock_lock (self.deviceMapLock );
352
- auto * devices = [self .nodeIDToDeviceMap objectEnumerator ].allObjects ;
353
- [_nodeIDToDeviceMap removeAllObjects ];
354
- os_unfair_lock_unlock (self.deviceMapLock );
355
-
356
- for (MTRDevice * device in devices) {
357
- [device invalidate ];
358
- }
359
- [self stopBrowseForCommissionables ];
360
-
361
- [_factory controllerShuttingDown: self ];
362
- }
363
-
364
- // Part of cleanupAfterStartup that has to interact with the Matter work queue
365
- // in a very specific way that only MTRDeviceControllerFactory knows about.
366
- - (void )shutDownCppController
367
- {
368
- MTR_LOG (" %s: %p" , __PRETTY_FUNCTION__, self);
369
- assertChipStackLockedByCurrentThread ();
370
-
371
- // Shut down all our endpoints.
372
- for (MTRServerEndpoint * endpoint in [_serverEndpoints copy ]) {
373
- [self removeServerEndpointOnMatterQueue: endpoint];
374
- }
375
-
376
- if (_cppCommissioner) {
377
- auto * commissionerToShutDown = _cppCommissioner;
378
- // Flag ourselves as not running before we start shutting down
379
- // _cppCommissioner, so we're not in a state where we claim to be
380
- // running but are actually partially shut down.
381
- _cppCommissioner = nullptr ;
382
- commissionerToShutDown->Shutdown ();
383
- // Don't clear out our fabric index association until controller
384
- // shutdown completes, in case it wants to write to storage as it
385
- // shuts down.
386
- _storedFabricIndex = chip::kUndefinedFabricIndex ;
387
- _storedCompressedFabricID = std::nullopt;
388
- self.nodeID = nil ;
389
- self.fabricID = nil ;
390
- self.rootPublicKey = nil ;
391
-
392
- delete commissionerToShutDown;
393
- if (_operationalCredentialsDelegate != nil ) {
394
- _operationalCredentialsDelegate->SetDeviceCommissioner (nullptr );
395
- }
396
- }
397
- }
398
-
399
- - (void )deinitFromFactory
400
- {
401
- [self cleanup ];
402
- }
403
-
404
- // Clean up any members we might have allocated.
405
- - (void )cleanup
406
- {
407
- VerifyOrDie (_cppCommissioner == nullptr );
408
-
409
- if (_defaultDACVerifier) {
410
- delete _defaultDACVerifier;
411
- _defaultDACVerifier = nullptr ;
412
- }
413
-
414
- if (_attestationTrustStoreBridge) {
415
- delete _attestationTrustStoreBridge;
416
- _attestationTrustStoreBridge = nullptr ;
417
- }
418
-
419
- [self clearDeviceAttestationDelegateBridge ];
420
-
421
- if (_operationalCredentialsDelegate) {
422
- delete _operationalCredentialsDelegate;
423
- _operationalCredentialsDelegate = nullptr ;
424
- }
425
-
426
- if (_partialDACVerifier) {
427
- delete _partialDACVerifier;
428
- _partialDACVerifier = nullptr ;
429
- }
430
-
431
- if (_deviceControllerDelegateBridge) {
432
- delete _deviceControllerDelegateBridge;
433
- _deviceControllerDelegateBridge = nullptr ;
434
- @synchronized (self) {
435
- _strongDelegateForSetDelegateAPI = nil ;
436
- [_delegates removeAllObjects ];
437
- }
438
- }
439
- }
440
-
441
342
- (NSNumber *)controllerNodeID
442
343
{
443
344
auto block = ^NSNumber * { return @(self->_cppCommissioner ->GetNodeId ()); };
@@ -968,19 +869,6 @@ - (void)removeServerEndpointOnMatterQueue:(MTRServerEndpoint *)endpoint
968
869
[_factory removeServerEndpoint: endpoint];
969
870
}
970
871
971
- - (BOOL )checkForInitError : (BOOL )condition logMsg : (NSString *)logMsg
972
- {
973
- if (condition) {
974
- return NO ;
975
- }
976
-
977
- MTR_LOG_ERROR (" %@ Error: %@" , self, logMsg);
978
-
979
- [self cleanup ];
980
-
981
- return YES ;
982
- }
983
-
984
872
- (void )clearDeviceAttestationDelegateBridge
985
873
{
986
874
if (_deviceAttestationDelegateBridge) {
0 commit comments