Commit c3bd93aa authored by Mikio Hara's avatar Mikio Hara Committed by Marcel van Lohuizen

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: 's avatarMarcel van Lohuizen <mpvl@golang.org>
parent 9e112a3f
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment