1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-16 22:45:03 -05:00

sockfilt: handle FD_CLOSE winsock event on write socket

Learn from the way Cygwin handles and maps the WinSock events
to simulate correct and complete poll and select behaviour
according to Richard W. Stevens Network Programming book.

Follow up to #5867
Closes #5879
This commit is contained in:
Marc Hoersken 2020-08-28 22:30:39 +02:00
parent 003e81e2a3
commit 5fcad1c1c6
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E

View File

@ -705,7 +705,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
if(FD_ISSET(wsasock, writefds)) {
FD_SET(wsasock, &writesock);
wsaevents.lNetworkEvents |= FD_WRITE|FD_CONNECT;
wsaevents.lNetworkEvents |= FD_WRITE|FD_CONNECT|FD_CLOSE;
}
if(FD_ISSET(wsasock, exceptfds)) {
@ -835,11 +835,11 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
FD_CLR(wsasock, readfds);
/* remove from descriptor set if not ready for write/connect */
if(!(wsaevents.lNetworkEvents & (FD_WRITE|FD_CONNECT)))
if(!(wsaevents.lNetworkEvents & (FD_WRITE|FD_CONNECT|FD_CLOSE)))
FD_CLR(wsasock, writefds);
/* remove from descriptor set if not exceptional */
if(!(wsaevents.lNetworkEvents & (FD_OOB)))
if(!(wsaevents.lNetworkEvents & FD_OOB))
FD_CLR(wsasock, exceptfds);
}
}