diff --git a/hack/tunnel/tunnel.go b/hack/tunnel/tunnel.go index 16753e430..216a1b193 100644 --- a/hack/tunnel/tunnel.go +++ b/hack/tunnel/tunnel.go @@ -140,10 +140,12 @@ func run(ctx context.Context, log *logrus.Entry) error { _, _ = io.Copy(c2, c) }() - defer func() { - _ = c.(*tls.Conn).CloseWrite() + func() { + defer func() { + _ = c.(*tls.Conn).CloseWrite() + }() + _, _ = io.Copy(c, c2) }() - _, _ = io.Copy(c, c2) <-ch }(c)