From 12080193f5d141731d6d94a4061a1cd96312ff62 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 7 Dec 2021 11:00:02 -0500 Subject: [PATCH] Always search on-network (#12321) * Always search on-network Nodes that have already been commissioned will always use on-network setup regardless of what is in the setup payload. * Comment from review. --- src/controller/SetUpCodePairer.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index 22f425bac3fa08..e9b5a0110138dc 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -62,24 +62,23 @@ CHIP_ERROR SetUpCodePairer::Connect(RendezvousInformationFlag rendezvousInformat VerifyOrReturnError(searchOverAll || CHIP_NO_ERROR == err, err); } - if (searchOverAll || rendezvousInformation == RendezvousInformationFlag::kOnNetwork) + if (searchOverAll || rendezvousInformation == RendezvousInformationFlag::kSoftAP) { - if (CHIP_NO_ERROR == - (err = StartDiscoverOverIP(isShort ? static_cast((discriminator >> 8) & 0x0F) : discriminator, isShort))) + if (CHIP_NO_ERROR == (err = StartDiscoverOverSoftAP(discriminator, isShort))) { isRunning = true; } VerifyOrReturnError(searchOverAll || CHIP_NO_ERROR == err, err); } - if (searchOverAll || rendezvousInformation == RendezvousInformationFlag::kSoftAP) + // We always want to search on network because any node that has already been commissioned will use on-network regardless of the + // QR code flag. + if (CHIP_NO_ERROR == + (err = StartDiscoverOverIP(isShort ? static_cast((discriminator >> 8) & 0x0F) : discriminator, isShort))) { - if (CHIP_NO_ERROR == (err = StartDiscoverOverSoftAP(discriminator, isShort))) - { - isRunning = true; - } - VerifyOrReturnError(searchOverAll || CHIP_NO_ERROR == err, err); + isRunning = true; } + VerifyOrReturnError(searchOverAll || CHIP_NO_ERROR == err, err); return isRunning ? CHIP_NO_ERROR : CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; }