mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
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:
parent
447b32f13a
commit
9bc8b078eb
7 changed files with 328 additions and 240 deletions
|
|
@ -71,7 +71,7 @@ typedef enum {
|
|||
|
||||
#define CURLPIPE_ANY (CURLPIPE_MULTIPLEX)
|
||||
|
||||
#ifndef CURL_DISABLE_SOCKETPAIR
|
||||
#if !defined(CURL_DISABLE_SOCKETPAIR) && !defined(USE_WINSOCK)
|
||||
#define ENABLE_WAKEUP
|
||||
#endif
|
||||
|
||||
|
|
@ -160,12 +160,11 @@ struct Curl_multi {
|
|||
|
||||
#ifdef USE_WINSOCK
|
||||
WSAEVENT wsa_event; /* Winsock event used for waits */
|
||||
#else
|
||||
#endif
|
||||
#ifdef ENABLE_WAKEUP
|
||||
curl_socket_t wakeup_pair[2]; /* eventfd()/pipe()/socketpair() used for
|
||||
wakeup 0 is used for read, 1 is used
|
||||
for write */
|
||||
#endif
|
||||
#endif
|
||||
unsigned int max_concurrent_streams;
|
||||
unsigned int maxconnects; /* if >0, a fixed limit of the maximum number of
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue