Skip to content

Commit f417a67

Browse files
committed
Address large download issues
Added packet timeout to http download Signed-off-by: Jared Baumann <[email protected]>
1 parent dc9f66f commit f417a67

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

samples/tmo_shell/src/tmo_http_request.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,6 @@ int create_http_socket(bool tls, char* host, struct addrinfo *res, struct net_if
303303
#endif
304304
}
305305
#endif
306-
struct timeval timeo_optval = {
307-
.tv_sec = 20,
308-
.tv_usec = 0,
309-
};
310-
zsock_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeo_optval, sizeof(timeo_optval));
311306
return sock;
312307
}
313308
#else
@@ -317,11 +312,6 @@ int create_http_socket(bool tls, char* host, struct addrinfo *res, struct net_if
317312
LOG_WRN("Using mocked socket for download.");
318313
int sock = -1;
319314
sock = http_fail_unit_test_socket_create();
320-
struct timeval timeo_optval = {
321-
.tv_sec = 20,
322-
.tv_usec = 0,
323-
};
324-
zsock_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeo_optval, sizeof(timeo_optval));
325315
return sock;
326316
}
327317
#endif
@@ -395,6 +385,7 @@ int tmo_http_download(int devid, char url[], char filename[], char *auth_key)
395385
req.response = response_cb_download;
396386
req.recv_buf = mxfer_buf;
397387
req.recv_buf_len = 4096;
388+
req.packet_timeout = 10000;
398389

399390
ret = tmo_offload_init(devid);
400391
if (ret != 0) {

0 commit comments

Comments
 (0)