From 35813074bcfaa6d7a51e2b9a09857d15bacb70cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Mon, 15 Nov 2021 19:06:08 +0100 Subject: [PATCH] [chip-tool] Restart address update on failure (#11779) 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. --- examples/chip-tool/commands/pairing/PairingCommand.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index d8a8efaacb55ef..ba8d75bcc28997 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -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(); } }