You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The listenerBacklog function returns a cached value of the optimal maximum permitted listener backlog on the current system, obtained in platform-specific ways. This is useful for user code that makes direct listen(2) syscalls and then calls net.FileListener to create a net.Listener.
// MaxListenerBacklog returns the maximum permitted listener backlog value on the current system.// The return value may be used as the backlog argument to the listen(2) syscall.funcMaxListenerBacklog() int
The text was updated successfully, but these errors were encountered:
I suggest a doc change. The point of this function in the net package is to determine the maximum permitted backlog argument, not the "optimal" backlog argument.
This function could easily be written as an external package. It doesn't really belong in the net package; as far as I know there are no functions in the net package that take a backlog argument. We could consider adding MaxListenerBacklog to the x/sys/unix package (there's not much point to adding it to x/sys/windows or x/sys/plan9, as on those systems there is nothing to look up).
I suggest a doc change. The point of this function in the net package is to determine the maximum permitted backlog argument, not the "optimal" backlog argument.
Thanks. Updated per your suggestion.
This function could easily be written as an external package. It doesn't really belong in the net package; as far as I know there are no functions in the net package that take a backlog argument. We could consider adding MaxListenerBacklog to the x/sys/unix package (there's not much point to adding it to x/sys/windows or x/sys/plan9, as on those systems there is nothing to look up).
I would prefer to have this function available on all platforms, just like how the unexported one in net is, so it's easier for people to switch from linknaming against net.listenerBacklog. It would also match the signature of syscall.Listen.
But I guess only adding MaxListenerBacklog to x/sys/unix works for me too, as tfo-go only uses this on Linux.
Proposal Details
The
listenerBacklog
function returns a cached value of theoptimalmaximum permitted listener backlog on the current system, obtained in platform-specific ways. This is useful for user code that makes directlisten(2)
syscalls and then callsnet.FileListener
to create anet.Listener
.Since the function signature is unlikely to change in the future, and we already had it exempted from the linkname restriction, I propose we add:
The text was updated successfully, but these errors were encountered: