Skip to content

Commit

Permalink
Swap CloseRead and CloseWrite
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
andre-luiz-dos-santos authored and thaJeztah committed Nov 10, 2023
1 parent 481d3d2 commit 7a67a58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions proxy/tcp_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 7a67a58

Please sign in to comment.