• Troels Thomsen's avatar
    net: Forget lookups for canceled contexts · 6a3d4be3
    Troels Thomsen authored
    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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    6a3d4be3
lookup.go 12.6 KB