[vlc-devel] [PATCH] [RFC] poll: add comment on WSAEventSelect()

Steve Lhomme robux4 at videolabs.io
Mon Nov 30 17:39:28 CET 2015


--
This line intrigued me a lot. It turns out accept returns an error "Non-socket
handle specified" if this call is not done, even though the FD_ACCEPT flag was
set. I assume we must release the event hook for that socket if we want to use
it.
---
 compat/poll.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/compat/poll.c b/compat/poll.c
index fa94c93..6a3e0d0 100644
--- a/compat/poll.c
+++ b/compat/poll.c
@@ -200,6 +200,7 @@ int poll(struct pollfd *fds, unsigned nfds, int timeout)
 
         if (WSAEnumNetworkEvents(fds[i].fd, evts[i], &ne))
             memset(&ne, 0, sizeof (ne));
+        /* unhook the event before we close it, otherwise the socket may fail */
         WSAEventSelect(fds[i].fd, evts[i], 0);
         WSACloseEvent(evts[i]);
 
-- 
2.6.3



More information about the vlc-devel mailing list