diff options
| author | Paul Buetow <paul@dionysus> | 2020-09-19 17:52:45 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@dionysus> | 2020-09-19 17:52:45 +0100 |
| commit | 813d2d00ec581c801d64091c7774988b559c3e93 (patch) | |
| tree | d491355684c3244860cb7d2c9ae2450f709db3e0 /internal/clients/remote | |
| parent | ec67d9833095dfbe620dd3c99ea0caba391c4b87 (diff) | |
refactor to have no context.Context in client handler structs
Diffstat (limited to 'internal/clients/remote')
| -rw-r--r-- | internal/clients/remote/connection.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/clients/remote/connection.go b/internal/clients/remote/connection.go index 2d97d14..b29ffed 100644 --- a/internal/clients/remote/connection.go +++ b/internal/clients/remote/connection.go @@ -177,21 +177,21 @@ func (c *Connection) handle(ctx context.Context, cancel context.CancelFunc, sess } go func() { - defer cancel() io.Copy(stdinPipe, c.Handler) + cancel() }() go func() { - defer cancel() io.Copy(c.Handler, stdoutPipe) + cancel() }() go func() { - defer cancel() select { case <-c.Handler.Done(): case <-ctx.Done(): } + cancel() }() // Send all commands to client. @@ -207,5 +207,6 @@ func (c *Connection) handle(ctx context.Context, cancel context.CancelFunc, sess } <-ctx.Done() + c.Handler.Shutdown() return nil } |
