LimitListener Motivations

66 views
Skip to first unread message

Nicholas Herring

unread,
Jan 6, 2021, 11:43:03 AM1/6/21
to golang-nuts
Hello,

I'm looking at https://pkg.go.dev/golang.org/x/net/netutil#LimitListener and trying to understand the nuances around the motivation.

It seems from looking at this that the LimitListener will *accept* the correct amount of connections, but after that will then leave new clients "hanging" without any feedback.

Does it not make more sense to reject the connection as quickly as possible instead of expecting the client to timeout? I understand this would mean accepting them just to close them , or is this a bad mental model? Does this design assume the application will always be receiving new connections?

I ask because I am looking to make a similar custom listener except it will be aware that it is part of a load balancer membership and needs to let the client know to try again somewhere else immediately because the application will be taken out of rotation.

Thoughts?

-Nick

Reply all
Reply to author
Forward
0 new messages