mirror of https://github.com/golang/go.git
net: don't leak test helper goroutine in TestAcceptTimeout
Fixes #15109. Change-Id: Ibfdedd6807322ebec84bacfeb492fb53fe066960 Reviewed-on: https://go-review.googlesource.com/23742 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
This commit is contained in:
parent
9e112a3fe4
commit
c3bd93aa26
|
|
@ -5,6 +5,7 @@
|
|||
package net
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"internal/testenv"
|
||||
"io"
|
||||
|
|
@ -164,10 +165,13 @@ func TestAcceptTimeout(t *testing.T) {
|
|||
}
|
||||
defer ln.Close()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
for i, tt := range acceptTimeoutTests {
|
||||
if tt.timeout < 0 {
|
||||
go func() {
|
||||
c, err := Dial(ln.Addr().Network(), ln.Addr().String())
|
||||
var d Dialer
|
||||
c, err := d.DialContext(ctx, ln.Addr().Network(), ln.Addr().String())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue