Skip to content

Commit

Permalink
Send OnSessionEstablishmentError if pairing in progress during shutdo…
Browse files Browse the repository at this point in the history
…wn (#15282)

* Send OnSessionEstablishmentError if pairing in progress during shutdown

* Check device is not null before checking if session in progress
  • Loading branch information
s-mcclain authored Feb 18, 2022
1 parent d7bcb65 commit 4d69db1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,14 @@ CHIP_ERROR DeviceCommissioner::Shutdown()

ChipLogDetail(Controller, "Shutting down the commissioner");

// Check to see if pairing in progress before shutting down
CommissioneeDeviceProxy * device = mDeviceBeingCommissioned;
if (device != nullptr && device->IsSessionSetupInProgress())
{
ChipLogDetail(Controller, "Setup in progress, stopping setup before shutting down");
OnSessionEstablishmentError(CHIP_ERROR_CONNECTION_ABORTED);
}

mSystemState->SessionMgr()->UnregisterRecoveryDelegate(*this);

#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable
Expand Down

0 comments on commit 4d69db1

Please sign in to comment.