vibe-d / eventcore

High performance proactor event loop abstraction library
MIT License
60 stars 42 forks source link

Simplified getBacklogSize #199

Closed kubo39 closed 2 years ago

s-ludwig commented 2 years ago

I found this in the OpenGroup documentation:

If listen() is called with a backlog argument value that is less than 0, the function behaves as if it had been called with a backlog argument value of 0.

A backlog argument of 0 may allow the socket to accept connections, in which case the length of the listen queue may be set to an implementation-defined minimum value.

I wonder whether Linux chooses an "implementation-defined minimum value" or behaves differently here. An alternative seems to be to simply always set this to 4096 (or some larger value) and let it be limited to the OS limit, regardless of the platform.

(Windows also has SOMAXCONN_HINT(n) => -n, which can be used to ignore the SOMAXCONN limit)