mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-18 11:33:23 +03:00
SocketSelector used fd_set + select() on every platform. On POSIX, descriptors >= FD_SETSIZE (1024) were rejected and only logged, so a UI inspector listener or client opened that high was never serviced. On Windows, the selector held at most 64 sockets (Winsock's default FD_SETSIZE). SocketSelector: - Use a shared pollfd implementation on every platform: poll() on POSIX and WSAPoll() on Windows. This removes both FD_SETSIZE limits. Store descriptors in a SmallVector<pollfd, 16>, which covers the inspector's peak without heap allocations. - Report POLLIN | POLLERR | POLLHUP as ready to match select()'s read readiness, so a peer disconnect still triggers the receive() that discovers it. Windows reports a graceful shutdown as POLLHUP. - Treat negative timeouts as an immediate check instead of an infinite wait. - Clear revents when poll() fails, so isReady() never reports readiness left over from an earlier wait. - An empty selector sleeps for a finite timeout and returns false; with an infinite timeout it returns immediately. WSAPoll() rejects empty sets, and nothing could ever become ready anyway. - Remove sockets by swapping with the last entry instead of shifting. - Raise the Winsock target to Vista (0x0600), the minimum for WSAPoll(). UI inspector: - Stop watching the listener while the 16-client limit is reached. A pending connection kept it readable, so every wait() returned immediately and the network thread spun. Tests: - Add SocketSelector tests for listener and data readiness, removal, duplicate adds, disconnect readiness, negative timeouts and empty selectors, plus a POSIX run with every descriptor above FD_SETSIZE. - Add HighFileDescriptorReservation, shared with Http.tcpConnectTimeoutHandlesFdAboveFdSetSize. It raises the soft RLIMIT_NOFILE when needed, so the high-fd tests run under common defaults (1024 on Linux, 256 on macOS) instead of being skipped. - Fix UIHTML.AttributeSelectorsMatchWidgetIds on Windows: it compared c_str() of a temporary that was destroyed before the check. - Fix UIHTML.StylesheetsDoNotPaintRawTextNodes on Windows: read the frame before display(), because Windows drivers don't preserve the back buffer after a buffer swap.