diff options
author | Dan Peterson <dpiddy@gmail.com> | 2016-04-28 09:41:32 -0300 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-04-28 15:13:58 +0000 |
commit | 9faf5cdf9d1f9050a03ae3d420768c846e54646d (patch) | |
tree | fb25c168ad5ce98fc4e9d65039c74234e277055a /src/net/dnsclient_unix.go | |
parent | 22db3c5a62b01dba6122230aa71d35c48107c70c (diff) | |
download | go-9faf5cdf9d1f9050a03ae3d420768c846e54646d.tar.gz go-9faf5cdf9d1f9050a03ae3d420768c846e54646d.zip |
net: change type of dnsConfig.timeout from int to time.Duration
Instead of keeping the desired number of seconds and converting to
time.Duration for every query, convert to time.Duration when
building the config.
Updates #15473
Change-Id: Ib24c050b593b3109011e359f4ed837a3fb45dc65
Reviewed-on: https://go-review.googlesource.com/22548
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/dnsclient_unix.go')
-rw-r--r-- | src/net/dnsclient_unix.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go index 3e31056a937..1adfda7b06a 100644 --- a/src/net/dnsclient_unix.go +++ b/src/net/dnsclient_unix.go @@ -180,8 +180,7 @@ func tryOneName(ctx context.Context, cfg *dnsConfig, name string, qtype uint16) return "", nil, &DNSError{Err: "no DNS servers", Name: name} } - timeout := time.Duration(cfg.timeout) * time.Second - deadline := time.Now().Add(timeout) + deadline := time.Now().Add(cfg.timeout) if old, ok := ctx.Deadline(); !ok || deadline.Before(old) { var cancel context.CancelFunc ctx, cancel = context.WithDeadline(ctx, deadline) |