Skip to content

Commit

Permalink
[nrf fromlist] net: lib: http: ensure SYS_FOREVER_MS behavior
Browse files Browse the repository at this point in the history
The http_client_req() function's timeout parameter is allowed
to be SYS_FOREVER_MS. However, K_MSEC() does not convert this
to a proper k_timeout_t, so sys_timepoint_calc() ends up
returning 0, which is causes immediate timeouts.

Check for this case specifically and force value passed to
sys_timepoint_calc() to be correct.

Upstream PR: a1610770f590ae7e6e625cfee6a6ca3058990959

Signed-off-by: Pete Skeggs <[email protected]>
  • Loading branch information
plskeggs authored and bjarki-andreasen committed Sep 28, 2024
1 parent 45b9114 commit f675106
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/http/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ int http_client_req(int sock, struct http_request *req,
int total_sent = 0;
int ret, total_recv, i;
const char *method;
k_timeout_t req_timeout = K_MSEC(timeout);
k_timeout_t req_timeout = (timeout == SYS_FOREVER_MS) ? K_FOREVER : K_MSEC(timeout);
k_timepoint_t req_end_timepoint = sys_timepoint_calc(req_timeout);

if (sock < 0 || req == NULL || req->response == NULL ||
Expand Down

0 comments on commit f675106

Please sign in to comment.