Commit 5d9f1c84 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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: default avatarIan Lance Taylor <iant@golang.org>
parent 5a3a5d35
...@@ -116,9 +116,10 @@ func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (* ...@@ -116,9 +116,10 @@ func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*
if timeout != 0 { if timeout != 0 {
errChannel = make(chan error, 2) errChannel = make(chan error, 2)
time.AfterFunc(timeout, func() { timer := time.AfterFunc(timeout, func() {
errChannel <- timeoutError{} errChannel <- timeoutError{}
}) })
defer timer.Stop()
} }
rawConn, err := dialer.Dial(network, addr) rawConn, err := dialer.Dial(network, addr)
......
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