mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
ssh/tailssh: terminate sessions on stdout copy failures
Currently, killing a SCP copy with a Ctrl+C leaves the session hanging even though the stdout copy goroutine fails with an io.EOF. Taking a step back, when we are unable to send any more data back to the client we should just terminate the session as the client will stop getting any response from the server anyways. Updates #3802 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
7cd8c3e839
commit
575aacb1e2
@ -946,15 +946,17 @@ func (ss *sshSession) run() {
|
||||
_, err := io.Copy(rec.writer("i", ss.stdin), ss)
|
||||
if err != nil {
|
||||
// TODO: don't log in the success case.
|
||||
logf("ssh: stdin copy: %v", err)
|
||||
logf("stdin copy: %v", err)
|
||||
}
|
||||
ss.stdin.Close()
|
||||
}()
|
||||
go func() {
|
||||
_, err := io.Copy(rec.writer("o", ss), ss.stdout)
|
||||
if err != nil {
|
||||
// TODO: don't log in the success case.
|
||||
logf("ssh: stdout copy: %v", err)
|
||||
logf("stdout copy: %v", err)
|
||||
// If we got an error here, it's probably because the client has
|
||||
// disconnected.
|
||||
ss.ctx.CloseWithError(err)
|
||||
}
|
||||
}()
|
||||
// stderr is nil for ptys.
|
||||
@ -962,8 +964,7 @@ func (ss *sshSession) run() {
|
||||
go func() {
|
||||
_, err := io.Copy(ss.Stderr(), ss.stderr)
|
||||
if err != nil {
|
||||
// TODO: don't log in the success case.
|
||||
logf("ssh: stderr copy: %v", err)
|
||||
logf("stderr copy: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user