]> Cypherpunks repositories - gostls13.git/commit
net: preserve unexpired context values for LookupIPAddr
authorEmmanuel T Odeke <emmanuel@orijtech.com>
Fri, 9 Nov 2018 06:08:35 +0000 (22:08 -0800)
committerEmmanuel Odeke <emm.odeke@gmail.com>
Mon, 12 Nov 2018 23:34:54 +0000 (23:34 +0000)
commit5d39260079b5170e6b4263adb4022cc4b54153c4
tree30920e721b1e18e39f83a451d79a82701075989d
parent70e3b1df4a5d5b91f6c0e7bd4f7879d6ae95fc12
net: preserve unexpired context values for LookupIPAddr

To avoid any cancelation of the parent context from affecting
lookupGroup operations, Resolver.LookupIPAddr previously used
an entirely new context created from context.Background().
However, this meant that all the values in the parent context
with which LookupIPAddr was invoked were dropped.

This change provides a custom context implementation
that only preserves values of the parent context by composing
context.Background() and the parent context. It only falls back
to the parent context to perform value lookups if the parent
context has not yet expired.
This context is never canceled, and has no deadlines.

Fixes #28600

Change-Id: If2f570caa26c65bad638b7102c35c79d5e429fea
Reviewed-on: https://go-review.googlesource.com/c/148698
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/lookup.go
src/net/lookup_test.go