From d1c6d8f0c016ab9cea8df751635f4460f263931a Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Fri, 7 Jan 2022 08:23:57 -0600 Subject: [PATCH] Remove workarounds for problems now addressed by #12794 and #13357 --- src/commissioner/States.h | 40 ++++++--------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/src/commissioner/States.h b/src/commissioner/States.h index 32af5e7e2e6bd4..778bbf3ec4f1dc 100644 --- a/src/commissioner/States.h +++ b/src/commissioner/States.h @@ -202,18 +202,9 @@ struct PasscodeAuthenticatedSessionEstablishment : CommissionableNodeDiscoverymCommissionee.mSystemState->SystemLayer()->ScheduleWork(Dispose, this); - } - - static void Dispose(System::Layer * layer, void * context) - { - auto state = static_cast(context); - state->ShutdownDiscoverer(); + // We need to wait for the discoverer to shutdown. Some platforms + // have no facility to interrupt BLE discovery. + this->ShutdownDiscoverer(); } void OnDiscovery() override {} @@ -727,13 +718,6 @@ struct CertificateAuthenticatedSessionEstablishment : Base, SessionEst this->mCtx.Dispatch(TContext::Event::template Create()); } - void DispatchStatus() - { - auto status = - mSuccess ? TContext::Event::template Create() : TContext::Event::template Create(); - this->mCtx.Dispatch(status); - } - protected: CHIP_ERROR GetNextCandidate() { @@ -806,30 +790,18 @@ struct CertificateAuthenticatedSessionEstablishment : Base, SessionEst if (err != CHIP_NO_ERROR) { ChipLogError(Controller, "Failed in setting up secure channel: err %s", ErrorStr(err)); + this->mCtx.Dispatch(TContext::Event::template Create()); } else { ChipLogDetail(Controller, "Remote device completed SPAKE2+ handshake"); - mSuccess = true; + this->mCtx.Dispatch(TContext::Event::template Create()); } - // We can't dustruct the CASESession object until the stack unwinds - // because the exchange isn't yet closed, the exchange has a pointer - // to the CASESession object, and ACK for the secure_channel Status - // Report hasn't been sent yet. Therefore, schedule dispatch, and - // implicit destruction, for the next iteration of the event loop. - this->mCommissionee.mSystemState->SystemLayer()->ScheduleWork(Dispose, this); - } - - static void Dispose(System::Layer * layer, void * context) - { - auto state = static_cast(context); - state->DispatchStatus(); } Platform::SharedPtr mRecord; Platform::SharedPtr mPairing; - size_t mIdx = 0; - bool mSuccess = false; + size_t mIdx = 0; }; template