Skip to content

Commit

Permalink
Fix handling of node ID resolution failure when mDeviceBeingPaired is…
Browse files Browse the repository at this point in the history
… not set. (#7383)

We should be calling DeviceController::OnNodeIdResolutionFailed but aren't.

Co-authored-by: bluebin14 <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Aug 31, 2021
1 parent 6286055 commit 07f0563
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,10 +1513,9 @@ void BasicFailure(void * context, uint8_t status)
#if CHIP_DEVICE_CONFIG_ENABLE_MDNS
void DeviceCommissioner::OnNodeIdResolved(const chip::Mdns::ResolvedNodeData & nodeData)
{
Device * device = nullptr;
if (mDeviceBeingPaired < kNumMaxActiveDevices)
{
device = &mActiveDevices[mDeviceBeingPaired];
Device * device = &mActiveDevices[mDeviceBeingPaired];
if (device->GetDeviceId() == nodeData.mPeerId.GetNodeId() && mCommissioningStage == CommissioningStage::kFindOperational)
{
AdvanceCommissioningStage(CHIP_NO_ERROR);
Expand All @@ -1527,16 +1526,13 @@ void DeviceCommissioner::OnNodeIdResolved(const chip::Mdns::ResolvedNodeData & n

void DeviceCommissioner::OnNodeIdResolutionFailed(const chip::PeerId & peer, CHIP_ERROR error)
{
Device * device = nullptr;
if (mDeviceBeingPaired >= kNumMaxActiveDevices)
{
return;
}

device = &mActiveDevices[mDeviceBeingPaired];
if (device->GetDeviceId() == peer.GetNodeId() && mCommissioningStage == CommissioningStage::kFindOperational)
if (mDeviceBeingPaired < kNumMaxActiveDevices)
{
OnSessionEstablishmentError(error);
Device * device = &mActiveDevices[mDeviceBeingPaired];
if (device->GetDeviceId() == peer.GetNodeId() && mCommissioningStage == CommissioningStage::kFindOperational)
{
OnSessionEstablishmentError(error);
}
}
DeviceController::OnNodeIdResolutionFailed(peer, error);
}
Expand Down

0 comments on commit 07f0563

Please sign in to comment.