1
0
mirror of https://github.com/golang/go synced 2024-11-05 11:36:10 -07:00

Revert "net: Forget lookups for canceled contexts"

This reverts commit 6a3d4be3b8.

Reason for revert: breaks various builds. See comments on CL 77670

Change-Id: Iaf3260319b560f49ace06af705a2114630f32063
Reviewed-on: https://go-review.googlesource.com/78515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Brad Fitzpatrick 2017-11-17 17:13:49 +00:00
parent d2414cefba
commit ac8a70d209
2 changed files with 1 additions and 23 deletions

View File

@ -200,7 +200,7 @@ func (r *Resolver) LookupIPAddr(ctx context.Context, host string) ([]IPAddr, err
// rather than waiting for the current lookup to
// complete. See issue 8602.
ctxErr := ctx.Err()
if ctxErr == context.Canceled || ctxErr == context.DeadlineExceeded {
if ctxErr == context.DeadlineExceeded {
lookupGroup.Forget(host)
}
err := mapErr(ctxErr)

View File

@ -739,25 +739,3 @@ func TestLookupNonLDH(t *testing.T) {
t.Fatalf("lookup error = %v, want %v", err, errNoSuchHost)
}
}
func TestLookupContextCancel(t *testing.T) {
if runtime.GOOS == "nacl" {
t.Skip("skip on NaCl")
}
ctx, ctxCancel := context.WithCancel(context.Background())
ctxCancel()
_, err := DefaultResolver.LookupIPAddr(ctx, "google.com")
if err != errCanceled {
testenv.SkipFlakyNet(t)
t.Fatalf("unexpected error: %q", err)
}
ctx = context.Background()
_, err = DefaultResolver.LookupIPAddr(ctx, "google.com")
if err != nil {
t.Fatalf("unexpected error: %q", err)
}
}