From 2b6e9122bd2c44a4b96e12ee4bbd125d569ecd4d Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 6 Sep 2013 09:49:07 +0000 Subject: [PATCH] Use the better name: SingleInflight --- client.go | 14 +++++++------- client_test.go | 4 ++-- dns.go | 2 +- server.go | 2 +- xfr.go | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client.go b/client.go index 847af4f5..02c17396 100644 --- a/client.go +++ b/client.go @@ -31,16 +31,16 @@ type reply struct { // A Client defines parameter for a DNS client. A nil // Client is usable for sending queries. type Client struct { - Net string // if "tcp" a TCP query will be initiated, otherwise an UDP one (default is "" for UDP) - ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections (ns), defaults to 2 * 1e9 - WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections (ns), defaults to 2 * 1e9 - TsigSecret map[string]string // secret(s) for Tsig map[], zonename must be fully qualified - Inflight bool // if true suppress multiple outstanding queries for the same Qname, Qtype and Qclass - group singleflight + Net string // if "tcp" a TCP query will be initiated, otherwise an UDP one (default is "" for UDP) + ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections (ns), defaults to 2 * 1e9 + WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections (ns), defaults to 2 * 1e9 + TsigSecret map[string]string // secret(s) for Tsig map[], zonename must be fully qualified + SingleInflight bool // if true suppress multiple outstanding queries for the same Qname, Qtype and Qclass + group singleflight } func (c *Client) exchangeMerge(m *Msg, a string, s net.Conn) (r *Msg, rtt time.Duration, err error) { - if !c.Inflight { + if !c.SingleInflight { if s == nil { return c.exchange(m, a) } diff --git a/client_test.go b/client_test.go index 63b6f326..0d93e961 100644 --- a/client_test.go +++ b/client_test.go @@ -41,12 +41,12 @@ func TestClientEDNS0(t *testing.T) { } } -func TestInflight(t *testing.T) { +func TestSingleSingleInflight(t *testing.T) { m := new(Msg) m.SetQuestion("miek.nl.", TypeDNSKEY) c := new(Client) - c.Inflight = true + c.SingleInflight = true nr := 10 ch := make(chan time.Duration) for i := 0; i < nr; i++ { diff --git a/dns.go b/dns.go index 003908c4..cc442f17 100644 --- a/dns.go +++ b/dns.go @@ -64,7 +64,7 @@ // For asynchronous queries it is easy to wrap Exchange() in a goroutine. Suppressing // multiple outstanding queries (with the same question, type and class) is as easy as setting: // -// c.Inflight = true +// c.SingleInflight = true // // A dns message consists out of four sections. // The question section: in.Question, the answer section: in.Answer, diff --git a/server.go b/server.go index 5314138b..a6eeff43 100644 --- a/server.go +++ b/server.go @@ -174,7 +174,7 @@ func (mux *ServeMux) match(q string, t uint16) Handler { for { l := len(q[off:]) for i := 0; i < l; i++ { - b[i] = q[off+i] | ( 'a' - 'A') + b[i] = q[off+i] | ('a' - 'A') } if h, ok := mux.z[string(b[:l])]; ok { // 'causes garbage, might want to change the map key if t != TypeDS { diff --git a/xfr.go b/xfr.go index 7655c1b1..77ea7e0f 100644 --- a/xfr.go +++ b/xfr.go @@ -70,7 +70,7 @@ func (w *reply) axfrIn(q *Msg, c chan *Envelope) { } first = !first // only one answer that is SOA, receive more - if (len(in.Answer) == 1) { + if len(in.Answer) == 1 { w.tsigTimersOnly = true c <- &Envelope{in.Answer, nil} continue