Skip to content

Commit

Permalink
fix TestCluster_OpenRaft is timeout #4853
Browse files Browse the repository at this point in the history
This bug is produce by tcp buffer, must flush tcp stream after the copy L53, but Flush is not exists in the net.TcpConn struct.
  • Loading branch information
mei-rune committed Nov 22, 2015
1 parent 6df6abe commit ce26ee3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions meta/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func proxy(dst, src *net.TCPConn) error {
// channels to wait on the close event for each connection
serverClosed := make(chan struct{}, 1)
clientClosed := make(chan struct{}, 1)
errors := make(chan error, 1)
errors := make(chan error, 2)

go broker(dst, src, clientClosed, errors)
go broker(src, dst, serverClosed, errors)
Expand All @@ -26,15 +26,15 @@ func proxy(dst, src *net.TCPConn) error {
// useful, so we can optionally SetLinger(0) here to recycle the port
// faster.
dst.SetLinger(0)
dst.CloseRead()
dst.Close()
waitFor = serverClosed
case <-serverClosed:
src.CloseRead()
src.Close()
waitFor = clientClosed
case err := <-errors:
src.CloseRead()
src.Close()
dst.SetLinger(0)
dst.CloseRead()
dst.Close()
return err
}

Expand Down

0 comments on commit ce26ee3

Please sign in to comment.