Skip to content

Commit efdf64b

Browse files
committed
Change retry behavior
Changed retry behavior to reset retry counter on data receipt. Signed-off-by: Jared Baumann <[email protected]>
1 parent fde3dcc commit efdf64b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

samples/tmo_shell/src/tmo_http_request.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,12 @@ int tmo_http_download(int devid, char url[], char filename[], char *auth_key)
486486
headers[0] = range_header;
487487
req.header_fields = (const char**)headers;
488488
// req.header_fields
489+
int last_rcvd_cnt = http_total_received;
489490
http_client_req(sock, &req, HTTP_CLIENT_REQ_TIMEOUT, &file);
491+
/* Reset count if new data has been transfered */
492+
if (last_rcvd_cnt < http_total_received) {
493+
fail_count = 0;
494+
}
490495
}
491496
if (http_total_received == http_total_written) {
492497
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)
514519
headers[0] = range_header;
515520
req.header_fields = (const char**)headers;
516521
// req.header_fields
522+
int last_rcvd_cnt = http_total_received;
517523
http_client_req(sock, &req, HTTP_CLIENT_REQ_TIMEOUT, &file);
524+
/* Reset count if new data has been transfered */
525+
if (last_rcvd_cnt < http_total_received) {
526+
fail_count = 0;
527+
}
518528
}
519529
printf("\n\nReceived:%d\n", http_total_received);
520530
}

0 commit comments

Comments
 (0)