Defense against badly behaved clients
In particular I'm missing
- a way to timeout connections that just sit on the connection and don't do anything
- a way to refuse connections after a certain connection# has been reached. This is important as connections consume resources and a samotop-based server might not be the most important service on a machine.
After breaking several skull bones against odd behaviors with 'atomic' numbers, I've hacked a connection limit in with some very nasty linux-specific behavior: when a connection is received, the server actually looks first at its own /proc/$$/fd to see if it has too many sockets open.
But for a timeouts I am resigned to have a cronjob test the server and restart it if it's stuck at max connections. async-std seems to offer timeout functionality in https://docs.rs/async-std/1.6.3/async_std/io/fn.timeout.html , but I don't really see how to fit that into poll_next of e.g. src/protocol/connection.rs