From 34198cd8798d76bb0f025357314fa0f089cf25ce Mon Sep 17 00:00:00 2001 From: Toby Date: Sat, 11 Apr 2020 15:53:29 -0700 Subject: [PATCH] forwarder: remove redundant closes in pipe goroutines --- internal/forwarder/client.go | 4 ---- internal/forwarder/server.go | 4 ---- 2 files changed, 8 deletions(-) diff --git a/internal/forwarder/client.go b/internal/forwarder/client.go index 0c1847f..71d313f 100644 --- a/internal/forwarder/client.go +++ b/internal/forwarder/client.go @@ -192,14 +192,10 @@ func (c *QUICClient) handleConn(conn net.Conn) { go func() { // TCP to QUIC errChan <- utils.Pipe(conn, stream, &c.outboundBytes) - _ = conn.Close() - _ = stream.Close() }() go func() { // QUIC to TCP errChan <- utils.Pipe(stream, conn, &c.inboundBytes) - _ = conn.Close() - _ = stream.Close() }() // We only need the first error err = <-errChan diff --git a/internal/forwarder/server.go b/internal/forwarder/server.go index 853d082..a3ac0f6 100644 --- a/internal/forwarder/server.go +++ b/internal/forwarder/server.go @@ -165,14 +165,10 @@ func (s *QUICServer) handleStream(addr net.Addr, name string, stream quic.Stream go func() { // TCP to QUIC errChan <- utils.Pipe(tcpConn, stream, &s.outboundBytes) - _ = tcpConn.Close() - _ = stream.Close() }() go func() { // QUIC to TCP errChan <- utils.Pipe(stream, tcpConn, &s.inboundBytes) - _ = tcpConn.Close() - _ = stream.Close() }() // We only need the first error err = <-errChan