From efdf64b780c03036a290dd13db127443c42495a6 Mon Sep 17 00:00:00 2001 From: Jared Baumann Date: Fri, 5 May 2023 17:03:02 +0000 Subject: [PATCH] Change retry behavior Changed retry behavior to reset retry counter on data receipt. Signed-off-by: Jared Baumann --- samples/tmo_shell/src/tmo_http_request.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/samples/tmo_shell/src/tmo_http_request.c b/samples/tmo_shell/src/tmo_http_request.c index 0913d3a..6bb5342 100644 --- a/samples/tmo_shell/src/tmo_http_request.c +++ b/samples/tmo_shell/src/tmo_http_request.c @@ -486,7 +486,12 @@ int tmo_http_download(int devid, char url[], char filename[], char *auth_key) headers[0] = range_header; req.header_fields = (const char**)headers; // req.header_fields + int last_rcvd_cnt = http_total_received; http_client_req(sock, &req, HTTP_CLIENT_REQ_TIMEOUT, &file); + /* Reset count if new data has been transfered */ + if (last_rcvd_cnt < http_total_received) { + fail_count = 0; + } } if (http_total_received == http_total_written) { printf("\nReceived:%d, Wrote: %d\n", http_total_received, http_total_written); @@ -514,7 +519,12 @@ int tmo_http_download(int devid, char url[], char filename[], char *auth_key) headers[0] = range_header; req.header_fields = (const char**)headers; // req.header_fields + int last_rcvd_cnt = http_total_received; http_client_req(sock, &req, HTTP_CLIENT_REQ_TIMEOUT, &file); + /* Reset count if new data has been transfered */ + if (last_rcvd_cnt < http_total_received) { + fail_count = 0; + } } printf("\n\nReceived:%d\n", http_total_received); }