ipn/ipnlocal: shutdown sshServer on tailscale down

Also lazify SSHServer initialization to allow restarting the server on a
subsequent `tailscale up`

Updates #3802

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-05-30 02:06:46 -07:00
committed by Maisem Ali
parent 4d85cf586b
commit 928530a112
3 changed files with 38 additions and 18 deletions

View File

@@ -110,7 +110,7 @@ func (srv *server) Shutdown() {
srv.shutdownCalled = true
for _, s := range srv.activeSessionByH {
s.ctx.CloseWithError(userVisibleError{
fmt.Sprintf("Tailscale shutting down.\r\n"),
fmt.Sprintf("Tailscale SSH is shutting down.\r\n"),
context.Canceled,
})
}
@@ -876,7 +876,7 @@ func (ss *sshSession) run() {
if srv.shutdownCalled {
srv.mu.Unlock()
// Do not start any new sessions.
fmt.Fprintf(ss, "Tailscale is shutting down\r\n")
fmt.Fprintf(ss, "Tailscale SSH is shutting down\r\n")
ss.Exit(1)
return
}