Implement new sftp-server option '-t idle_timeout'. When there is no user activity for idle_timeout seconds, sftp session is forcibly closed by the server. By default there is no time limit.
Created attachment 2981 [details] sftp idle timeout
This feature was requested by a user, who claims that the large number of opened, inactive but unterminated sftp client connections prolongs fail-over to other cluster node, when performing regular maintenance tasks. This extended fail-over time causes application outages, when various application time outs are met. With the ability to configure sftp-server to terminate inactive sftp connections after time-out, the user hopes to keep the number of these connections down and avoid application outages.
the select() syscall has a timeout option on it that is currently set to NULL. why not initialize that to the timeout you want and check the return values in the loop for that condition ? then you don't need to muck around with signal/alarm. you should update the usage string too so `sftp-server -h` includes the new option.