From 7a67a58690ec00e92abd9fedb3b1b99c95bbbd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz=20dos=20Santos?= Date: Fri, 29 Jan 2016 18:20:59 -0200 Subject: [PATCH] Swap CloseRead and CloseWrite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To notify the other end of a connection that no writes are going to happen anymore, CloseWrite() should be used. Signed-off-by: André Luiz dos Santos --- proxy/tcp_proxy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/tcp_proxy.go b/proxy/tcp_proxy.go index 083bb94f..f2876513 100644 --- a/proxy/tcp_proxy.go +++ b/proxy/tcp_proxy.go @@ -52,10 +52,10 @@ func (proxy *TCPProxy) clientLoop(client *net.TCPConn, quit chan bool) { // 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() + _ = from.CloseRead() } } - _ = to.CloseRead() + _ = to.CloseWrite() event <- written }