A global terminal user-inactivity watchdog would be helpful to prevent denial of service
Terminal server nodes can be excessively occupied by bots (idling at a login prompt/matrix), broken user SSH connections that somehow stay alive long after the TCP connection has been dropped, or logged-in users that execute an external program (door) that performs no inactivity detection and then just sit idle.
Normally, user inactivity is detected in Synchronet or door program input methods (e.g. getkey(), getstr() - sending warnings to the user before disconnection due to inactivity), but if a custom login module is performing output animations while polling for keyboard input from the user, they may do this for a very long period (forever?) until the client disconnects. And this can very easily lead to nodes tied up by dumb bots.
Similarly, if a user runs an external program that perform no inactivity detection, they may just sit idle indefinitely, tying up that node. Synchronet does have a "monitor time left" option in SCFG that enables Synchronet to monitor the amount of time the user has left for their call, but that does not check for user inactivity: an inactive user can still just sit idle in such programs for hours, potentially.
What I'm imagining is a global method for setting a user inactivity (i.e. a watchdog) timer that would get reset whenever any data is received from the user/client (e.g. in input_thread()) and if the timeout value is reached, the socket is disconnected. This should work (disconnect inactive connections) for all scripts and external programs, even misbehaving ones (think: infinite loop). Considerations:
- account for exempt users (e.g. the 'H' exemption)
- account for explicitly-allowed-to-idle portions of the board (e.g. the ^P prompt, the IRC client)
- provide warning before disconnection (maybe send some ^G's?)
- use a longer timeout value than the normal inactivity warning/hang-up values used by getkey()