Skip to content

Commit 65f2077

Browse files
authored
Merge pull request #156 from tmobile/tmo-CFSPDK-1273-Fix-2mb-download
Change retry behavior
2 parents efcfc30 + efdf64b commit 65f2077

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

samples/tmo_shell/src/tmo_http_request.c

+10
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)