time-keeping: keep timestamp in multi, always update

Always use curlx_now() when calling Curl_pgrs_now(data). Tests with the
"manual" updates to now proved differ more then 100ms in parallel testing.

Add `curlx_nowp()` to set current time into a struct curltime.
Add `curlx_ptimediff_ms() and friends, passing pointers.

Update documentation.

Closes #19998
This commit is contained in:
Stefan Eissing 2025-12-18 13:55:07 +01:00 committed by Daniel Stenberg
parent 308c347c8b
commit b4be1f271e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
61 changed files with 471 additions and 502 deletions

View file

@ -306,8 +306,8 @@ static void h2_stream_hash_free(unsigned int id, void *stream)
static int32_t cf_h2_get_desired_local_win(struct Curl_cfilter *cf,
struct Curl_easy *data)
{
curl_off_t avail =
Curl_rlimit_avail(&data->progress.dl.rlimit, &data->progress.now);
curl_off_t avail = Curl_rlimit_avail(&data->progress.dl.rlimit,
Curl_pgrs_now(data));
(void)cf;
if(avail < CURL_OFF_T_MAX) { /* limit in place */
@ -1424,7 +1424,7 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
struct Curl_cfilter *cf = userp;
struct cf_h2_ctx *ctx = cf->ctx;
struct h2_stream_ctx *stream;
struct Curl_easy *data_s, *calling = CF_DATA_CURRENT(cf);
struct Curl_easy *data_s;
(void)flags;
DEBUGASSERT(stream_id); /* should never be a zero stream ID here */
@ -1445,8 +1445,6 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
stream = H2_STREAM_CTX(ctx, data_s);
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
if(calling)
Curl_pgrs_now_update(data_s, calling);
h2_xfer_write_resp(cf, data_s, stream, (const char *)mem, len, FALSE);