Don't log io.ErrClosedPipe in proxy.

We expect one of these at the end of just about every proxy session, as
the Conns in both directions are closed as soon as the copy loop
finishes in one direction.

Closes #40016.
This commit is contained in:
David Fifield 2020-10-22 23:01:45 -06:00
parent 6baa3c4d5f
commit 912bcae24e

View file

@ -300,7 +300,9 @@ func CopyLoop(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser) {
var wg sync.WaitGroup var wg sync.WaitGroup
copyer := func(dst io.ReadWriteCloser, src io.ReadWriteCloser) { copyer := func(dst io.ReadWriteCloser, src io.ReadWriteCloser) {
defer wg.Done() defer wg.Done()
if _, err := io.Copy(dst, src); err != nil { // Ignore io.ErrClosedPipe because it is likely caused by the
// termination of copyer in the other direction.
if _, err := io.Copy(dst, src); err != nil && err != io.ErrClosedPipe {
log.Printf("io.Copy inside CopyLoop generated an error: %v", err) log.Printf("io.Copy inside CopyLoop generated an error: %v", err)
} }
dst.Close() dst.Close()