From 1715826439520f3b04b0c4af867e92c32b0e7244 Mon Sep 17 00:00:00 2001 From: "Irene Siu (Apple)" Date: Wed, 1 Jun 2022 20:44:57 -0700 Subject: [PATCH] [OTA-R] Correct the implementation of mProviderRetryCount (#18908) * Implemented fix for Issue #18824. * - Remove debug code. - scripts/helpers/restyle-diff.sh * Code review changes. * Code review changes. - Remove reset from DefaultOTARequestorDriver::UpdateDownloaded() --- examples/ota-requestor-app/linux/main.cpp | 6 +++++- src/app/clusters/ota-requestor/DefaultOTARequestor.cpp | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index 4aa4a96bb051c2..10c1c595d6aa67 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -126,11 +126,15 @@ void CustomOTARequestorDriver::UpdateDownloaded() { if (gAutoApplyImage) { - // Let the default driver take further action to apply the image + // Let the default driver take further action to apply the image. + // All member variables will be implicitly reset upon loading into the new image. DefaultOTARequestorDriver::UpdateDownloaded(); } else { + // Download complete but we're not going to apply image, so reset provider retry counter. + mProviderRetryCount = 0; + // Reset to put the state back to idle to allow the next OTA update to occur gRequestorCore.Reset(); } diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp b/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp index f36bf5d1a96439..39aa512596305d 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp +++ b/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp @@ -621,7 +621,6 @@ void DefaultOTARequestor::OnDownloadStateChanged(OTADownloader::State state, OTA { RecordErrorUpdateState(CHIP_ERROR_CONNECTION_ABORTED, reason); } - break; default: break;