1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:50:07 -07:00

crypto/tls: stop a timeout timer

I noticed this leak while writing CL 214977.

Change-Id: I7566952b8e4bc58939d23435aea86576fc58ddca
Reviewed-on: https://go-review.googlesource.com/c/go/+/214978
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Brad Fitzpatrick 2020-01-15 19:29:33 +00:00
parent 5a3a5d3525
commit 5d9f1c847f

View File

@ -116,9 +116,10 @@ func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*
if timeout != 0 {
errChannel = make(chan error, 2)
time.AfterFunc(timeout, func() {
timer := time.AfterFunc(timeout, func() {
errChannel <- timeoutError{}
})
defer timer.Stop()
}
rawConn, err := dialer.Dial(network, addr)