Skip to content

Commit

Permalink
Don't try to establish PASE while we are shutting down. (#20706)
Browse files Browse the repository at this point in the history
Shutdown of a DeviceCommissioner needs to suppress the "try the next
discovered thing on error" behavior of SetUpCodePairer.

Fixes #20271
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jul 19, 2023
1 parent 30c5e82 commit 9893844
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ void DeviceCommissioner::Shutdown()

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

mSetUpCodePairer.CommissionerShuttingDown();

// Check to see if pairing in progress before shutting down
CommissioneeDeviceProxy * device = mDeviceInPASEEstablishment;
if (device != nullptr && device->IsSessionSetupInProgress())
Expand Down
5 changes: 5 additions & 0 deletions src/controller/SetUpCodePairer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ void SetUpCodePairer::NotifyCommissionableDeviceDiscovered(const Dnssd::Discover
ConnectToDiscoveredDevice();
}

void SetUpCodePairer::CommissionerShuttingDown()
{
ResetDiscoveryState();
}

bool SetUpCodePairer::TryNextRendezvousParameters()
{
if (ConnectToDiscoveredDevice())
Expand Down
4 changes: 4 additions & 0 deletions src/controller/SetUpCodePairer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class DLL_EXPORT SetUpCodePairer : public DevicePairingDelegate
void SetBleLayer(Ble::BleLayer * bleLayer) { mBleLayer = bleLayer; };
#endif // CONFIG_NETWORK_LAYER_BLE

// Called to notify us that the DeviceCommissioner is shutting down and we
// should not try to do any more new work.
void CommissionerShuttingDown();

private:
// DevicePairingDelegate implementation.
void OnStatusUpdate(DevicePairingDelegate::Status status) override;
Expand Down

0 comments on commit 9893844

Please sign in to comment.