multi: improve wakeup and wait code

- Split WINSOCK and POSIX code in `multi_wait()` as the ifdef'ery
  was becoming unreadable
- define `ENABLE_WAKEUP` to mean the wakeup socketpair is enabled,
  no additional USE_WINSOCK check needed. Under WINSOCK
  `ENABLE_WAKEUP` is not defined, so it's availability is as before
  under the double defined() checks
- When the multi handle has "alive" transfers, the admin handle's
  pollset include the wakeup receive socket. This results in the
  admin handle running when someone uses `curl_multi_wakeup()`.
- Without any "alive" transfers, the wakeup socket is removed from
  the pollset. Otherwise, event based processing would never finish,
  eg. leave the event loop.
- The wakeup socket was never registered for event processing before,
  e.g. `curl_multi_wakeup()` never worked in that mode.
- Adjust test exepectations on socket callback invocations and
  number of sockets appearing in waitfds sets.

Closes #20832
This commit is contained in:
Stefan Eissing 2026-03-06 10:10:55 +01:00 committed by Daniel Stenberg
parent 447b32f13a
commit 9bc8b078eb
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 328 additions and 240 deletions

View file

@ -603,10 +603,8 @@ void Curl_multi_ev_xfer_done(struct Curl_multi *multi,
struct Curl_easy *data)
{
DEBUGASSERT(!data->conn); /* transfer should have been detached */
if(data != multi->admin) {
(void)mev_assess(multi, data, NULL);
Curl_meta_remove(data, CURL_META_MEV_POLLSET);
}
(void)mev_assess(multi, data, NULL);
Curl_meta_remove(data, CURL_META_MEV_POLLSET);
}
void Curl_multi_ev_conn_done(struct Curl_multi *multi,