Skip to content

Commit ac8a70d

Browse files
committed
Revert "net: Forget lookups for canceled contexts"
This reverts commit 6a3d4be. 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 <[email protected]>
1 parent d2414ce commit ac8a70d

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

src/net/lookup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (r *Resolver) LookupIPAddr(ctx context.Context, host string) ([]IPAddr, err
200200
// rather than waiting for the current lookup to
201201
// complete. See issue 8602.
202202
ctxErr := ctx.Err()
203-
if ctxErr == context.Canceled || ctxErr == context.DeadlineExceeded {
203+
if ctxErr == context.DeadlineExceeded {
204204
lookupGroup.Forget(host)
205205
}
206206
err := mapErr(ctxErr)

src/net/lookup_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -739,25 +739,3 @@ func TestLookupNonLDH(t *testing.T) {
739739
t.Fatalf("lookup error = %v, want %v", err, errNoSuchHost)
740740
}
741741
}
742-
743-
func TestLookupContextCancel(t *testing.T) {
744-
if runtime.GOOS == "nacl" {
745-
t.Skip("skip on NaCl")
746-
}
747-
748-
ctx, ctxCancel := context.WithCancel(context.Background())
749-
ctxCancel()
750-
751-
_, err := DefaultResolver.LookupIPAddr(ctx, "google.com")
752-
if err != errCanceled {
753-
testenv.SkipFlakyNet(t)
754-
t.Fatalf("unexpected error: %q", err)
755-
}
756-
757-
ctx = context.Background()
758-
759-
_, err = DefaultResolver.LookupIPAddr(ctx, "google.com")
760-
if err != nil {
761-
t.Fatalf("unexpected error: %q", err)
762-
}
763-
}

0 commit comments

Comments
 (0)