From 9893844d199f8395f4841c17cdcf45e17aa516b1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 14 Jul 2022 10:35:45 -0400 Subject: [PATCH] Don't try to establish PASE while we are shutting down. (#20706) Shutdown of a DeviceCommissioner needs to suppress the "try the next discovered thing on error" behavior of SetUpCodePairer. Fixes https://github.com/project-chip/connectedhomeip/issues/20271 --- src/controller/CHIPDeviceController.cpp | 2 ++ src/controller/SetUpCodePairer.cpp | 5 +++++ src/controller/SetUpCodePairer.h | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 8422f5508d4bf3..8466dc5723a423 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -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()) diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index 5457687e6bb2b4..98af2e86ea4ad1 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -308,6 +308,11 @@ void SetUpCodePairer::NotifyCommissionableDeviceDiscovered(const Dnssd::Discover ConnectToDiscoveredDevice(); } +void SetUpCodePairer::CommissionerShuttingDown() +{ + ResetDiscoveryState(); +} + bool SetUpCodePairer::TryNextRendezvousParameters() { if (ConnectToDiscoveredDevice()) diff --git a/src/controller/SetUpCodePairer.h b/src/controller/SetUpCodePairer.h index 8a47b6a69364d4..fdf54dbc10be09 100644 --- a/src/controller/SetUpCodePairer.h +++ b/src/controller/SetUpCodePairer.h @@ -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;