Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

OTA fixes #1586

Merged
merged 4 commits into from
Dec 6, 2019
Merged

OTA fixes #1586

merged 4 commits into from
Dec 6, 2019

Conversation

tgsong
Copy link

@tgsong tgsong commented Dec 6, 2019

Description

This PR addresses some issues in current OTA code,

  • aws_iot_ota_mqtt.h should be included when MQTT is selected in data or control.
  • When HTTP send fails, the error callback will be invoked directly, we need to set the error status in http downloader. Before this case is not handled.
  • Now the "connection" field is always checked when receiving a HTTP response to see if we need to connect. Before if error happens during the response callback routine, this will not be executed.
  • Fix the way that momentum is handled in OTA downloads. We should always increase the momentum after sending the request. Before the momentum is only increased if the request function returns failure. However, both MQTT and HTTP requests are async and it could return success but we still fail to receive the response and the OTA agent would just stuck here forever. Instead we can just rely on prvProcessDataHandler to reset the momentum, which is called after we successfully get and process a response.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • My code is Linted.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

dan4thewin
dan4thewin previously approved these changes Dec 6, 2019
@aws-afr-bot
Copy link

uncrustify failed. Please run it manually and resubmit the PR

We shouldn't reset the momentum inside prvRequestDataHandler because the
request is async and it could return success but we still fail to
receive the response. The momentum should instead just be reset in
prvProcessDataHandler and we already do that, which is called after we
get a response
@tgsong tgsong merged commit 94b57e1 into aws:release-candidate Dec 6, 2019
@tgsong tgsong deleted the ota_fix branch December 6, 2019 19:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants