]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi_wait: fix skipping to populate revents for extra_fds
authorMarc Hoersken <info@marc-hoersken.de>
Mon, 25 Jul 2022 20:29:27 +0000 (22:29 +0200)
committerMarc Hoersken <info@marc-hoersken.de>
Thu, 25 Aug 2022 21:31:24 +0000 (23:31 +0200)
On Windows revents was not populated for extra_fds if
multi_wait had to wait due to the Curl_poll pre-check
not signalling any readiness. This commit fixes that.

Reviewed-by: Marcel Raad
Reviewed-by: Jay Satiro
Closes #9361

lib/multi.c

index b20bd9ad3f8ac4e1e060b306cba69fa363903028..5cd0277aee7c2878e79c095d47f4e65158b58c5f 100644 (file)
@@ -1366,8 +1366,9 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
         unsigned r = ufds[curlfds + i].revents;
         unsigned short mask = 0;
 #ifdef USE_WINSOCK
+        curl_socket_t s = extra_fds[i].fd;
         wsa_events.lNetworkEvents = 0;
-        if(WSAEnumNetworkEvents(extra_fds[i].fd, NULL, &wsa_events) == 0) {
+        if(WSAEnumNetworkEvents(s, NULL, &wsa_events) == 0) {
           if(wsa_events.lNetworkEvents & (FD_READ|FD_ACCEPT|FD_CLOSE))
             mask |= CURL_WAIT_POLLIN;
           if(wsa_events.lNetworkEvents & (FD_WRITE|FD_CONNECT|FD_CLOSE))
@@ -1377,9 +1378,11 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
           if(ret && pollrc <= 0 && wsa_events.lNetworkEvents)
             retcode++;
         }
-        WSAEventSelect(extra_fds[i].fd, multi->wsa_event, 0);
-        if(pollrc <= 0)
+        WSAEventSelect(s, multi->wsa_event, 0);
+        if(pollrc <= 0) {
+          extra_fds[i].revents = mask;
           continue;
+        }
 #endif
         if(r & POLLIN)
           mask |= CURL_WAIT_POLLIN;