mirror of
https://github.com/curl/curl.git
synced 2026-04-15 00:01:41 +03:00
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:
parent
308c347c8b
commit
b4be1f271e
61 changed files with 471 additions and 502 deletions
|
|
@ -148,7 +148,7 @@ static CURLcode test_unit1303(const char *arg)
|
|||
NOW(run[i].now_s, run[i].now_us);
|
||||
TIMEOUTS(run[i].timeout_ms, run[i].connecttimeout_ms);
|
||||
easy->progress.now = now;
|
||||
timeout = Curl_timeleft_ms(easy, run[i].connecting);
|
||||
timeout = Curl_timeleft_now_ms(easy, &now, run[i].connecting);
|
||||
if(timeout != run[i].result)
|
||||
fail(run[i].comment);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static CURLcode test_unit1309(const char *arg)
|
|||
key.tv_usec = (541 * i) % 1023;
|
||||
storage[i] = key.tv_usec;
|
||||
Curl_splayset(&nodes[i], &storage[i]);
|
||||
root = Curl_splayinsert(key, root, &nodes[i]);
|
||||
root = Curl_splayinsert(&key, root, &nodes[i]);
|
||||
}
|
||||
|
||||
puts("Result:");
|
||||
|
|
@ -111,7 +111,7 @@ static CURLcode test_unit1309(const char *arg)
|
|||
for(j = 0; j <= i % 3; j++) {
|
||||
storage[i * 3 + j] = key.tv_usec * 10 + j;
|
||||
Curl_splayset(&nodes[i * 3 + j], &storage[i * 3 + j]);
|
||||
root = Curl_splayinsert(key, root, &nodes[i * 3 + j]);
|
||||
root = Curl_splayinsert(&key, root, &nodes[i * 3 + j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -119,12 +119,12 @@ static CURLcode test_unit1309(const char *arg)
|
|||
for(i = 0; i <= 1100; i += 100) {
|
||||
curl_mprintf("Removing nodes not larger than %d\n", i);
|
||||
tv_now.tv_usec = i;
|
||||
root = Curl_splaygetbest(tv_now, root, &removed);
|
||||
root = Curl_splaygetbest(&tv_now, root, &removed);
|
||||
while(removed) {
|
||||
curl_mprintf("removed payload %zu[%zu]\n",
|
||||
*(size_t *)Curl_splayget(removed) / 10,
|
||||
*(size_t *)Curl_splayget(removed) % 10);
|
||||
root = Curl_splaygetbest(tv_now, root, &removed);
|
||||
root = Curl_splaygetbest(&tv_now, root, &removed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ static CURLcode test_unit1399(const char *arg)
|
|||
struct Curl_easy data;
|
||||
struct curltime now = curlx_now();
|
||||
|
||||
data.multi = NULL;
|
||||
data.progress.now = now;
|
||||
data.progress.t_nslookup = 0;
|
||||
data.progress.t_connect = 0;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "urldata.h"
|
||||
#include "connect.h"
|
||||
#include "progress.h"
|
||||
#include "curl_share.h"
|
||||
|
||||
static CURLcode t1607_setup(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue