dcrodman/archon

Implement an upper bound on number of connections

Closed this issue · 0 comments

As is, any number of clients can connect to the server and each will cause a new Goroutine to be spawned to handle it. There should be a configuration option to set a maximum number of connections to the server so that an admin can somewhat limit the server's use of system resources.

Using the builtin len function to check the size of the list won't be enough as this will cause a O(n) operation to be performed for every single connection to the server and will grow as connections are accepted. An optimization may be to explicitly keep track of the length as part of the synchronized RW wrapper around the connection list in util.