Skip to content

Commit 7b2b1fe

Browse files
author
Santhosh Manohar
authored
Merge pull request #1617 from AkihiroSuda/cleanup
proxy: clean up code (addendum to #1598)
2 parents a193122 + 252567a commit 7b2b1fe

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

cmd/proxy/tcp_proxy.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"log"
66
"net"
77
"sync"
8-
"syscall"
98
)
109

1110
// 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) {
4140

4241
var wg sync.WaitGroup
4342
var broker = func(to, from *net.TCPConn) {
44-
if _, err := io.Copy(to, from); err != nil {
45-
// If the socket we are writing to is shutdown with
46-
// SHUT_WR, forward it to the other end of the pipe:
47-
if err, ok := err.(*net.OpError); ok && err.Err == syscall.EPIPE {
48-
from.CloseWrite()
49-
}
50-
}
43+
io.Copy(to, from)
5144
from.CloseRead()
5245
to.CloseWrite()
5346
wg.Done()

0 commit comments

Comments
 (0)