Skip to content

Commit

Permalink
fix teardown error using a separate context
Browse files Browse the repository at this point in the history
  • Loading branch information
easeway committed Aug 8, 2020
1 parent 313602a commit 32a54df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/ssh/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ func (c *connection) forwardRun(ctx context.Context, faddr forwardAddr, ln net.L
go closeWhenDone(ctx, ln)
defer func() {
c.removeListener(faddr, ln)
if err := c.server.setupForwarder(ctx, faddr.String(), localAddr, false); err != nil {
// Use a different context as the current one may be already canceled.
if err := c.server.setupForwarder(context.Background(), faddr.String(), localAddr, false); err != nil {
c.log("%s teardown error: %v", logPrefix, err)
}
c.log("%s", logPrefix)
Expand Down

0 comments on commit 32a54df

Please sign in to comment.