man pages for
kqueue give me the following:
EVFILT_READ Takes a descriptor as the identifier, and returns whenever there is data available to read. The behavior of the filter is slightly different depending on the descriptor type. Sockets Sockets which have previously been passed to listen() return when there is an incoming connection pending. data contains the size of the listen backlog.
The question follows, is above backlog value equals the number of total backlog size, or, the value equals the actual backlog size, as the event returns to a user?
It equals to the actual listen queue size. Yes, the actual connection(
accept) may not succeed. But, I do not think that the listen queue size will change while
accept calls being made. I’m not so competent in reading source code, but I can do a simple logic:
1. There is a list of connections waiting to be accepted. 2. The connection may either succeed or fail. 3. If the connection succeeds, it does not change a queue size. 4. If the connection fails, the `accept` function returns the reason. 5. From above, the status of a connection will not change actual listen backlog. You also can made this logic from error codes of `accept` function. If the system removes a connection, the accept returns an error.