feat: add headless mode support for SSH -N connections

- use s.lifecycle.GetConnection().Wait() to block until SSH connection closes
- Prevent premature session closure in headless mode

In headless mode (ssh -N), there's no channel interaction to block on,
so the session would immediately return and close. Now blocking on
conn.Wait() keeps the session alive until the client disconnects.
This commit is contained in:
2026-01-11 15:21:11 +07:00
parent 8b0e08c629
commit da29df85b7
5 changed files with 65 additions and 14 deletions
-1
View File
@@ -90,7 +90,6 @@ func (s *Server) handleConnection(conn net.Conn) {
user = u
cancel()
}
log.Println("SSH connection established:", sshConn.User())
sshSession := session.New(sshConn, forwardingReqs, chans, s.sessionRegistry, user)
err = sshSession.Start()