lib: updatehub: Kconfig: Add coap max retry option
The current implementation uses a fixed value for max retries. That value could be good for an wired network like Ethernet. However, wireless network can suffer with higher packet collision, low reception signal etc. This refacts the variable to be defined at Kconfig. This way max retries can be adjust conform the current media. Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
This commit is contained in:
parent
a7c63d8818
commit
6c4c12d531
2 changed files with 12 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018, 2019 O.S.Systems
|
||||
# Copyright (c) 2018-2020 O.S.Systems
|
||||
# SPDX -License-Identifier: Apache-2.0
|
||||
|
||||
menuconfig UPDATEHUB
|
||||
|
@ -86,6 +86,15 @@ config UPDATEHUB_DTLS
|
|||
Enables DTLS communication between the UpdateHub
|
||||
client and the server
|
||||
|
||||
config UPDATEHUB_COAP_MAX_RETRY
|
||||
int "Maximum retries attempts to download a packet"
|
||||
default 10
|
||||
range 3 10
|
||||
depends on UPDATEHUB
|
||||
help
|
||||
Set the maximum number of retries attempts to download a packet
|
||||
before abort a current update.
|
||||
|
||||
module = UPDATEHUB
|
||||
module-str = Log level for UpdateHub
|
||||
module-help = Enables logging for UpdateHub code.
|
||||
|
|
|
@ -42,7 +42,6 @@ LOG_MODULE_REGISTER(updatehub, CONFIG_UPDATEHUB_LOG_LEVEL);
|
|||
* otherwise download size will be less than real size.
|
||||
*/
|
||||
#define MAX_DOWNLOAD_DATA (MAX_PAYLOAD_SIZE + 32)
|
||||
#define COAP_MAX_RETRY 3
|
||||
#define MAX_IP_SIZE 30
|
||||
|
||||
#define SHA256_HEX_DIGEST_SIZE ((TC_SHA256_DIGEST_SIZE * 2) + 1)
|
||||
|
@ -486,7 +485,8 @@ static enum updatehub_response install_update(void)
|
|||
}
|
||||
|
||||
if (verification_download == ctx.downloaded_size) {
|
||||
if (attempts_download == COAP_MAX_RETRY) {
|
||||
if (attempts_download ==
|
||||
CONFIG_UPDATEHUB_COAP_MAX_RETRY) {
|
||||
LOG_ERR("Could not get the packet");
|
||||
ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR;
|
||||
goto cleanup;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue