diff options
author | Stephen Ma <stephenm@golang.org> | 2010-03-03 15:25:26 +1100 |
---|---|---|
committer | Stephen Ma <stephenm@golang.org> | 2010-03-03 15:25:26 +1100 |
commit | 0ace7c76df6bd5aa3db8f6c5ac8465f8b0ef799c (patch) | |
tree | 87f0cdc6b9a2d2eb0368ad11401ae20780e008d8 /src/pkg/net | |
parent | 16568244650f5a3179ad4c7865b507f290866e23 (diff) | |
download | golang-0ace7c76df6bd5aa3db8f6c5ac8465f8b0ef799c.tar.gz |
net: correct DNS configuration
Set defaults to the same values as various C DNS resolver libraries.
Use the timeout value from the configuration.
Fixes issue 632.
R=rsc
CC=golang-dev
http://codereview.appspot.com/223094
Diffstat (limited to 'src/pkg/net')
-rw-r--r-- | src/pkg/net/dnsclient.go | 2 | ||||
-rw-r--r-- | src/pkg/net/dnsconfig.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/pkg/net/dnsclient.go b/src/pkg/net/dnsclient.go index 0a6fca011..387a9bbf9 100644 --- a/src/pkg/net/dnsclient.go +++ b/src/pkg/net/dnsclient.go @@ -62,7 +62,7 @@ func _Exchange(cfg *_DNS_Config, c Conn, name string) (m *_DNS_Msg, err os.Error return nil, err } - c.SetReadTimeout(1e9) // nanoseconds + c.SetReadTimeout(int64(cfg.timeout) * 1e9) // nanoseconds buf := make([]byte, 2000) // More than enough. n, err = c.Read(buf) diff --git a/src/pkg/net/dnsconfig.go b/src/pkg/net/dnsconfig.go index b2153e07d..7d098583d 100644 --- a/src/pkg/net/dnsconfig.go +++ b/src/pkg/net/dnsconfig.go @@ -32,8 +32,8 @@ func _DNS_ReadConfig() (*_DNS_Config, os.Error) { conf.servers = make([]string, 3)[0:0] // small, but the standard limit conf.search = make([]string, 0) conf.ndots = 1 - conf.timeout = 1 - conf.attempts = 1 + conf.timeout = 5 + conf.attempts = 2 conf.rotate = false for line, ok := file.readLine(); ok; line, ok = file.readLine() { f := getFields(line) |