From 956ec9b962384952126ca4a8122268a1e9e6d50d Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 20 Sep 2011 17:40:13 +0200 Subject: [PATCH] set the timeouts --- client.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 8db2e412..97f08ae4 100644 --- a/client.go +++ b/client.go @@ -126,8 +126,8 @@ type Client struct { Retry bool // retry with TCP QueryChan chan *Request // read DNS request from this channel ReplyChan chan *Exchange // write the reply (together with the DNS request) to this channel - ReadTimeout int64 // the net.Conn.SetReadTimeout value for new connections - WriteTimeout int64 // the net.Conn.SetWriteTimeout value for new connections + ReadTimeout int64 // the net.Conn.SetReadTimeout value for new connections (ns) + WriteTimeout int64 // the net.Conn.SetWriteTimeout value for new connections (ns) TsigSecret map[string]string // secret(s) for Tsig map[] Hijacked net.Conn // if set the calling code takes care of the connection // LocalAddr string // Local address to use @@ -384,6 +384,9 @@ func (w *reply) writeClient(p []byte) (n int, err os.Error) { if err = w.Dial(); err != nil { return 0, err } + w.conn.SetWriteTimeout(w.Client().WriteTimeout) + w.conn.SetReadTimeout(w.Client().ReadTimeout) + } switch w.Client().Net { case "tcp", "tcp4", "tcp6":