Use the better name: SingleInflight

This commit is contained in:
Miek Gieben 2013-09-06 09:49:07 +00:00
parent 0adc9a3afe
commit 2b6e9122bd
5 changed files with 12 additions and 12 deletions

View File

@ -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>]<base64 secret>, 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>]<base64 secret>, 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)
}

View File

@ -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++ {

2
dns.go
View File

@ -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,

View File

@ -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 {

2
xfr.go
View File

@ -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