]> Cypherpunks repositories - gostls13.git/commit
net: Forget lookups for canceled contexts
authorTroels Thomsen <troels@thomsen.io>
Tue, 14 Nov 2017 22:22:19 +0000 (23:22 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 15 Nov 2017 22:34:55 +0000 (22:34 +0000)
commit6a3d4be3b80054b1d802b73d5a519e252e0f82ed
treef3915379b4036160f23f92c15cc1da5fd4b127fa
parent3a181dc7bc8fd0c61d6090a85f87c934f1874802
net: Forget lookups for canceled contexts

A sequential lookup using any non-canceled context has a risk of
returning the result of the previous lookup for a canceled context (i.e.
an error).

This is already prevented for timed out context by forgetting the host
immediately and extending this to also compare the error to
`context.Canceled` resolves this issue.

Fixes #22724

Change-Id: I7aafa1459a0de4dc5c4332988fbea23cbf4dba07
Reviewed-on: https://go-review.googlesource.com/77670
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/lookup.go
src/net/lookup_test.go