Explorar o código

proxy: clean up code (addendum to #1598)

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Akihiro Suda %!s(int64=8) %!d(string=hai) anos
pai
achega
d3e7ca726d
Modificáronse 1 ficheiros con 1 adicións e 8 borrados
  1. 1 8
      libnetwork/cmd/proxy/tcp_proxy.go

+ 1 - 8
libnetwork/cmd/proxy/tcp_proxy.go

@@ -5,7 +5,6 @@ import (
 	"log"
 	"net"
 	"sync"
-	"syscall"
 )
 
 // TCPProxy is a proxy for TCP connections. It implements the Proxy interface to
@@ -41,13 +40,7 @@ func (proxy *TCPProxy) clientLoop(client *net.TCPConn, quit chan bool) {
 
 	var wg sync.WaitGroup
 	var broker = func(to, from *net.TCPConn) {
-		if _, err := io.Copy(to, from); err != nil {
-			// If the socket we are writing to is shutdown with
-			// SHUT_WR, forward it to the other end of the pipe:
-			if err, ok := err.(*net.OpError); ok && err.Err == syscall.EPIPE {
-				from.CloseWrite()
-			}
-		}
+		io.Copy(to, from)
 		from.CloseRead()
 		to.CloseWrite()
 		wg.Done()