mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-09-02 14:53:46 +00:00
The accept loop in Server::listen_internal() classified accept() failures by reading errno, but Winsock reports them through WSAGetLastError() and never touches the CRT errno. Both retry branches were therefore dead code on Windows, and every accept() failure fell through to the fatal path, which closes the listening socket and ends listen(). That is reachable in normal operation: a peer resetting a pending connection before it is accepted is enough, and descriptor or buffer exhaustion shows up under load. One such event stopped the server from accepting anything again. Add is_accept_resource_error() and is_accept_transient_error() next to is_connection_error(), which already abstracts the same errno vs WSAGetLastError() difference, and use them in the accept loop. The POSIX sets are widened to match the Windows ones rather than being left as they were: ECONNABORTED is the POSIX spelling of the aborted pending connection that motivates this, and ENFILE, ENOBUFS and ENOMEM are resource exhaustion in the same sense as EMFILE.