mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: treat a nil *Resolver as a zero one, as documented
Add accessors that handle nil without crashing. Fixes #24330 Change-Id: If5fbbb6015ca8d65f620a06bad6e52de8cd896ad Reviewed-on: https://go-review.googlesource.com/101315 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
This commit is contained in:
parent
5a4e09837c
commit
5c3cb64b2e
6 changed files with 37 additions and 10 deletions
|
|
@ -377,7 +377,7 @@ func (r *Resolver) lookup(ctx context.Context, name string, qtype dnsmessage.Typ
|
|||
if err == nil {
|
||||
break
|
||||
}
|
||||
if nerr, ok := err.(Error); ok && nerr.Temporary() && r.StrictErrors {
|
||||
if nerr, ok := err.(Error); ok && nerr.Temporary() && r.strictErrors() {
|
||||
// If we hit a temporary error with StrictErrors enabled,
|
||||
// stop immediately instead of trying more names.
|
||||
break
|
||||
|
|
@ -565,7 +565,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, name string, order
|
|||
for range qtypes {
|
||||
racer := <-lane
|
||||
if racer.error != nil {
|
||||
if nerr, ok := racer.error.(Error); ok && nerr.Temporary() && r.StrictErrors {
|
||||
if nerr, ok := racer.error.(Error); ok && nerr.Temporary() && r.strictErrors() {
|
||||
// This error will abort the nameList loop.
|
||||
hitStrictError = true
|
||||
lastErr = racer.error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue