mirror of
https://github.com/moby/moby.git
synced 2025-07-29 07:21:35 +03:00
Merge pull request #40595 from sfzhu93/GL_2_25
[integration] add buffer to prevent goroutine leak
This commit is contained in:
@ -43,14 +43,14 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *testing.T) {
|
||||
expected := []byte("hello")
|
||||
actual := make([]byte, len(expected))
|
||||
|
||||
outChan := make(chan error)
|
||||
outChan := make(chan error, 1)
|
||||
go func() {
|
||||
_, err := io.ReadFull(ws, actual)
|
||||
outChan <- err
|
||||
close(outChan)
|
||||
}()
|
||||
|
||||
inChan := make(chan error)
|
||||
inChan := make(chan error, 1)
|
||||
go func() {
|
||||
_, err := ws.Write(expected)
|
||||
inChan <- err
|
||||
@ -279,7 +279,7 @@ func bodyIsWritable(r *http.Response) bool {
|
||||
|
||||
// readTimeout read from io.Reader with timeout
|
||||
func readTimeout(r io.Reader, buf []byte, timeout time.Duration) (n int, err error) {
|
||||
ch := make(chan bool)
|
||||
ch := make(chan bool, 1)
|
||||
go func() {
|
||||
n, err = io.ReadFull(r, buf)
|
||||
ch <- true
|
||||
|
Reference in New Issue
Block a user