From 5fcad1c1c6b5301870b2a21f070e86f1a797b624 Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Fri, 28 Aug 2020 22:30:39 +0200 Subject: [PATCH] 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 --- tests/server/sockfilt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } } -- 2.47.3