Skip to content

Commit

Permalink
[chip-tool] Restart address update on failure (#11779)
Browse files Browse the repository at this point in the history
For some devices, it may take more time to appear on the
network and become discoverable over DNS-SD, so don't give
up on the address resolution failure and restart the
address update.
  • Loading branch information
Damian-Nordic authored and pull[bot] committed Dec 14, 2021
1 parent 0ab58ae commit be64484
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/chip-tool/commands/pairing/PairingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,13 @@ CHIP_ERROR PairingCommand::UpdateNetworkAddress()
void PairingCommand::OnAddressUpdateComplete(NodeId nodeId, CHIP_ERROR err)
{
ChipLogProgress(chipTool, "OnAddressUpdateComplete: %" PRIx64 ": %s", nodeId, ErrorStr(err));
if (err != CHIP_NO_ERROR && nodeId == mNodeId)
if (err != CHIP_NO_ERROR)
{
// Set exit status only if the address update failed.
// Otherwise wait for OnCommissioningComplete() callback.
SetCommandExitStatus(err);
// For some devices, it may take more time to appear on the network and become discoverable
// over DNS-SD, so don't give up on failure and restart the address update. Note that this
// will not be repeated endlessly as each chip-tool command has a timeout (in the case of
// the `pairing` command it equals 120s).
UpdateNetworkAddress();
}
}

Expand Down

0 comments on commit be64484

Please sign in to comment.