Skip to content

Commit

Permalink
Update CHIPDeviceController.cpp
Browse files Browse the repository at this point in the history
Fix application (chip-device-ctrl) hang caused by mdns resolve callback not being called
  • Loading branch information
bluebin14 authored May 28, 2021
1 parent 34bccf5 commit 811fb56
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1526,32 +1526,26 @@ 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)
{
return;
}

device = &mActiveDevices[mDeviceBeingPaired];
if (device->GetDeviceId() == nodeData.mPeerId.GetNodeId() && mCommissioningStage == CommissioningStage::kFindOperational)
if (mDeviceBeingPaired < kNumMaxActiveDevices)
{
AdvanceCommissioningStage(CHIP_NO_ERROR);
Device * device = &mActiveDevices[mDeviceBeingPaired];
if (device->GetDeviceId() == nodeData.mPeerId.GetNodeId() && mCommissioningStage == CommissioningStage::kFindOperational)
{
AdvanceCommissioningStage(CHIP_NO_ERROR);
}
}
DeviceController::OnNodeIdResolved(nodeData);
}

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 811fb56

Please sign in to comment.