Skip to content

Commit

Permalink
[ota-requestor] Added update cancelling in case of apply failure (#27591
Browse files Browse the repository at this point in the history
)

The Ota Requestor's Apply API returns CHIP_ERROR, however it is
not handled by the DefaultOTARequestorDriver.

Added cancelling update in case of Apply failure to reset the
OTA Requestor state and prevent stucking in kApplying state.
  • Loading branch information
kkasperczyk-no authored and pull[bot] committed Nov 3, 2023
1 parent f1030d7 commit 2475362
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ void DefaultOTARequestorDriver::ApplyTimerHandler(System::Layer * systemLayer, v
DefaultOTARequestorDriver * driver = ToDriver(appState);

VerifyOrDie(driver->mImageProcessor != nullptr);
driver->mImageProcessor->Apply();

if (driver->mImageProcessor->Apply() != CHIP_NO_ERROR)
{
driver->mRequestor->CancelImageUpdate();
}
}

void DefaultOTARequestorDriver::UpdateAvailable(const UpdateDescription & update, System::Clock::Seconds32 delay)
Expand Down

0 comments on commit 2475362

Please sign in to comment.