diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-04-16 14:17:40 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-04-18 16:30:03 +0000 |
commit | f60fcca5f1e7b7a33e219ec45d4bd9dc58dd2552 (patch) | |
tree | 50e3a59df9b4c3be2f79df2e116c49024d97eaf4 /src/net/lookup.go | |
parent | a3c92c9db137413b17447a72c334c3e560bace06 (diff) | |
download | go-f60fcca5f1e7b7a33e219ec45d4bd9dc58dd2552.tar.gz go-f60fcca5f1e7b7a33e219ec45d4bd9dc58dd2552.zip |
net: fix plan9 after context change, propagate contexts more
My previous https://golang.org/cl/22101 to add context throughout the
net package broke Plan 9, which isn't currently tested (#15251).
It also broke some old unsupported version of Windows (Windows 2000?)
which doesn't have the ConnectEx function, but that was only found
visually, since our minimum supported Windows version has ConnectEx.
This change simplifies the Windows and deletes the non-ConnectEx code
path. Windows 2000 will work even less now, if it even worked
before. Windows XP remains our minimum supported version.
Specifically, the previous CL stopped using the "dial" function, which
0intro noted:
https://github.com/golang/go/issues/15333#issuecomment-210842761
This CL removes the dial function instead and makes plan9's net
implementation respect contexts, which likely fixes a number of
t.Skipped tests. I'm leaving that to 0intro to investigate.
In the process of propagating and respecting contexts for plan9, I had
to change some signatures to add contexts to more places and ended up
pushing contexts down into the Go-based DNS resolution as well,
replacing the pure-Go DNS implementation's use of "timeout
time.Duration" with a context instead.
Updates #11932
Updates #15328
Fixes #15333
Change-Id: I6ad1e62f38271cdd86b3f40921f2d0f23374936a
Reviewed-on: https://go-review.googlesource.com/22144
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/lookup.go')
-rw-r--r-- | src/net/lookup.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net/lookup.go b/src/net/lookup.go index 8f02787422..5e60011165 100644 --- a/src/net/lookup.go +++ b/src/net/lookup.go @@ -114,7 +114,7 @@ func lookupIPContext(ctx context.Context, host string) (addrs []IPAddr, err erro func LookupPort(network, service string) (port int, err error) { port, needsLookup := parsePort(service) if needsLookup { - port, err = lookupPort(network, service) + port, err = lookupPort(context.Background(), network, service) if err != nil { return 0, err } @@ -130,7 +130,7 @@ func LookupPort(network, service string) (port int, err error) { // LookupHost or LookupIP directly; both take care of resolving // the canonical name as part of the lookup. func LookupCNAME(name string) (cname string, err error) { - return lookupCNAME(name) + return lookupCNAME(context.Background(), name) } // LookupSRV tries to resolve an SRV query of the given service, @@ -143,26 +143,26 @@ func LookupCNAME(name string) (cname string, err error) { // publishing SRV records under non-standard names, if both service // and proto are empty strings, LookupSRV looks up name directly. func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) { - return lookupSRV(service, proto, name) + return lookupSRV(context.Background(), service, proto, name) } // LookupMX returns the DNS MX records for the given domain name sorted by preference. func LookupMX(name string) (mxs []*MX, err error) { - return lookupMX(name) + return lookupMX(context.Background(), name) } // LookupNS returns the DNS NS records for the given domain name. func LookupNS(name string) (nss []*NS, err error) { - return lookupNS(name) + return lookupNS(context.Background(), name) } // LookupTXT returns the DNS TXT records for the given domain name. func LookupTXT(name string) (txts []string, err error) { - return lookupTXT(name) + return lookupTXT(context.Background(), name) } // LookupAddr performs a reverse lookup for the given address, returning a list // of names mapping to that address. func LookupAddr(addr string) (names []string, err error) { - return lookupAddr(addr) + return lookupAddr(context.Background(), addr) } |