Skip to content

Commit

Permalink
Always search on-network (#12321)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
cecille authored and pull[bot] committed Feb 16, 2022
1 parent fb6bbdb commit 1546348
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/controller/SetUpCodePairer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>((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<uint16_t>((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;
}
Expand Down

0 comments on commit 1546348

Please sign in to comment.