Commit ec7c6c16 authored by Ian Lance Taylor's avatar Ian Lance Taylor

net: don't forget about ongoing DNS lookup if context canceled

Only forget about it if the context timed out, as the comment says.

Fixes #20703.

Change-Id: Ie6234f1a32f85e6bfd052dc24a33aa63b8883c37
Reviewed-on: https://go-review.googlesource.com/45999
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 5ee4858a
......@@ -185,12 +185,15 @@ func (r *Resolver) LookupIPAddr(ctx context.Context, host string) ([]IPAddr, err
select {
case <-ctx.Done():
// The DNS lookup timed out for some reason. Force
// If the DNS lookup timed out for some reason, force
// future requests to start the DNS lookup again
// rather than waiting for the current lookup to
// complete. See issue 8602.
err := mapErr(ctx.Err())
ctxErr := ctx.Err()
if ctxErr == context.DeadlineExceeded {
lookupGroup.Forget(host)
}
err := mapErr(ctxErr)
if trace != nil && trace.DNSDone != nil {
trace.DNSDone(nil, false, err)
}
......
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