tests/server: sync wait_ms() with the libcurl implementation

It contains a series of bugfixes and updates applied to libcurl's
`Curl_wait_ms()` over the years, but missed from the copy in
`tests/server/util.c`:
- d65321f939,
  52e822173a,
  5912da253b
- 4a8f459837
- 1ad49feb71

It fixes `wait_ms()` to check for, and return `SOCKERRNO`. Fixing error
handling on Windows.

Also:
- tests/server: change callers to check `SOCKERRNO`.
- `wait_ms()`: fix to check for the correct error code on Windows.
  Pending for `Curl_wait_ms()`: #16621.
- `Curl_wait_ms()`: tidy-up `Sleep()` argument cast (nit).
- lib/curl_trc: drop an unused header.

Closes #16627
This commit is contained in:
Viktor Szakats 2025-03-08 22:15:07 +01:00
parent 454762d5ca
commit 5681628e2d
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 34 additions and 51 deletions

View file

@ -1253,9 +1253,9 @@ static curl_socket_t sockfilt_sockdaemon(curl_socket_t sock,
rc = wait_ms(delay);
if(rc) {
/* should not happen */
error = errno;
error = SOCKERRNO;
logmsg("wait_ms() failed with error (%d) %s",
error, strerror(error));
error, sstrerror(error));
sclose(sock);
return CURL_SOCKET_BAD;
}