Workaround for libev handle caching bug on windows
The windows socket api uses handles, not fds. Libev caches the handle associated with an fd, and uses this handle when updating the (also cached) handle set that goes into select(). When an fd is closed and subsequently re-used before the event loop returns to libev, libev fails to detect properly that the handle changed. And even if it does, the cached handle of the closed socket is overwritten by the new handle, so by the time libev tries to update the select fdset it has forgotten which handle to remove from it. This is solved by a simple hook ev_fd_closed that makes it clear its caches before the fd is re-used.
parent
55518466
Please register or sign in to comment