Skip to content

Commit

Permalink
Ignore DeviceCommissioner::OnDeviceConnectionFailureFn for unexpected…
Browse files Browse the repository at this point in the history
… devices. (#22247)

Just like we ignore DeviceCommissioner::OnDeviceConnectedFn if the
device id does not match mDeviceBeingCommissioned, we should ignore
OnDeviceConnectionFailureFn.

Fixes #22244
  • Loading branch information
bzbarsky-apple authored Aug 30, 2022
1 parent 70143fe commit b444d25
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,13 @@ void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, const Scope
error = CHIP_ERROR_INTERNAL;
}

if (commissioner->mDeviceBeingCommissioned == nullptr ||
commissioner->mDeviceBeingCommissioned->GetDeviceId() != peerId.GetNodeId())
{
// Not the device we are trying to commission.
return;
}

if (commissioner->mCommissioningStage == CommissioningStage::kFindOperational &&
commissioner->mCommissioningDelegate != nullptr)
{
Expand Down

0 comments on commit b444d25

Please sign in to comment.