From: Marc Hoersken Date: Fri, 28 Aug 2020 20:30:39 +0000 (+0200) Subject: sockfilt: handle FD_CLOSE winsock event on write socket X-Git-Tag: curl-7_73_0~189 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fcad1c1c6b5301870b2a21f070e86f1a797b624;p=thirdparty%2Fcurl.git 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 --- diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 6b3758c949..f5281817d1 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -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); } }