From 954986a43e3637e1e23073fa9afc73732df89067 Mon Sep 17 00:00:00 2001 From: Harsha Rajendran Date: Wed, 16 Nov 2022 14:23:32 -0500 Subject: [PATCH] Update BdxOtaSender to only cease polling upon successful transfer of the bulk data --- examples/ota-provider-app/esp32/main/BdxOtaSender.cpp | 1 + .../ota-provider-app/ota-provider-common/BdxOtaSender.cpp | 1 + scripts/tests/ota_test.sh | 4 ++-- src/protocols/bdx/TransferFacilitator.cpp | 1 - 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/ota-provider-app/esp32/main/BdxOtaSender.cpp b/examples/ota-provider-app/esp32/main/BdxOtaSender.cpp index 9cb2b5c0536008..37be9761aa81b8 100644 --- a/examples/ota-provider-app/esp32/main/BdxOtaSender.cpp +++ b/examples/ota-provider-app/esp32/main/BdxOtaSender.cpp @@ -174,6 +174,7 @@ void BdxOtaSender::HandleTransferSessionOutput(TransferSession::OutputEvent & ev { ChipLogError(BDX, "onTransferComplete Callback not set"); } + mStopPolling = true; // Stop polling the TransferSession only after receiving BlockAckEOF Reset(); break; case TransferSession::OutputEventType::kStatusReceived: diff --git a/examples/ota-provider-app/ota-provider-common/BdxOtaSender.cpp b/examples/ota-provider-app/ota-provider-common/BdxOtaSender.cpp index 2aa29dda45f66c..5c3f2213427035 100644 --- a/examples/ota-provider-app/ota-provider-common/BdxOtaSender.cpp +++ b/examples/ota-provider-app/ota-provider-common/BdxOtaSender.cpp @@ -180,6 +180,7 @@ void BdxOtaSender::HandleTransferSessionOutput(TransferSession::OutputEvent & ev break; case TransferSession::OutputEventType::kAckEOFReceived: ChipLogDetail(BDX, "Transfer completed, got AckEOF"); + mStopPolling = true; // Stop polling the TransferSession only after receiving BlockAckEOF Reset(); break; case TransferSession::OutputEventType::kStatusReceived: diff --git a/scripts/tests/ota_test.sh b/scripts/tests/ota_test.sh index fc9a326547eef9..8667f8258f96ce 100755 --- a/scripts/tests/ota_test.sh +++ b/scripts/tests/ota_test.sh @@ -26,7 +26,7 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux "$OTA_PROVI echo "Test" >"$FIRMWARE_BIN" -rm /tmp/chip_* +rm -f /tmp/chip_* ./src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 10 -vs "10.0" -da sha256 "$FIRMWARE_BIN" "$FIRMWARE_OTA" @@ -75,7 +75,7 @@ else RETURN_VALUE=1 fi -killall -e "$OTA_PROVIDER_APP" "$OTA_REQUESTOR_APP" +killall -s SIGKILL -e "$OTA_PROVIDER_APP" "$OTA_REQUESTOR_APP" rm -f "$FIRMWARE_OTA" "$FIRMWARE_BIN" "$OTA_DOWNLOAD_PATH" echo "$TEST_RESULT" diff --git a/src/protocols/bdx/TransferFacilitator.cpp b/src/protocols/bdx/TransferFacilitator.cpp index 767d16313994e4..65ab653420c2cd 100644 --- a/src/protocols/bdx/TransferFacilitator.cpp +++ b/src/protocols/bdx/TransferFacilitator.cpp @@ -112,7 +112,6 @@ CHIP_ERROR Responder::PrepareForTransfer(System::Layer * layer, TransferRole rol void Responder::ResetTransfer() { mTransfer.Reset(); - mStopPolling = true; } CHIP_ERROR Initiator::InitiateTransfer(System::Layer * layer, TransferRole role, const TransferSession::TransferInitData & initData,