Merge branch 'master' of github.com:miekg/dns

This commit is contained in:
Miek Gieben 2015-09-22 07:44:04 +01:00
commit 859f7da631
3 changed files with 2 additions and 51 deletions

View File

@ -42,6 +42,7 @@ A not-so-up-to-date-list-that-may-be-actually-current:
* https://play.google.com/store/apps/details?id=com.turbobytes.dig
* https://github.com/fcambus/statzone
* https://github.com/benschw/dns-clb-go
* https://github.com/corny/dnscheck for http://public-dns.tk/
Send pull request if you want to be listed here.

View File

@ -161,56 +161,6 @@ func TestClientEDNS0Local(t *testing.T) {
}
}
func TestSingleInflight(t *testing.T) {
// Test is inherently racy, because queries might actually be returned before the test
// is over, leading to multiple queries even with SingleInflight. This ofcourse then
// leads to diff. rrts and the test fails. Number of tests is now 3, to lower the chance
// for the race to hit.
HandleFunc("miek.nl.", HelloServer)
defer HandleRemove("miek.nl.")
s, addrstr, err := RunLocalUDPServer("127.0.0.1:0")
if err != nil {
t.Fatalf("Unable to run test server: %v", err)
}
defer s.Shutdown()
m := new(Msg)
m.SetQuestion("miek.nl.", TypeDNSKEY)
c := new(Client)
c.SingleInflight = true
nr := 3
ch := make(chan time.Duration)
for i := 0; i < nr; i++ {
go func() {
_, rtt, _ := c.Exchange(m, addrstr)
ch <- rtt
}()
}
i := 0
var first time.Duration
// With inflight *all* rtt are identical, and by doing actual lookups
// the chances that this is a coincidence is small.
Loop:
for {
select {
case rtt := <-ch:
if i == 0 {
first = rtt
} else {
if first != rtt {
t.Errorf("all rtts should be equal, got %d want %d", rtt, first)
}
}
i++
if i == nr {
break Loop
}
}
}
}
// ExampleUpdateLeaseTSIG shows how to update a lease signed with TSIG.
func ExampleUpdateLeaseTSIG(t *testing.T) {
m := new(Msg)

2
doc.go
View File

@ -184,7 +184,7 @@ Basic use pattern validating and replying to a message that has TSIG set.
dns.HandleFunc(".", handleRequest)
func handleRequest(w dns.ResponseWriter, r *dns.Msg) {
m := new(Msg)
m := new(dns.Msg)
m.SetReply(r)
if r.IsTsig() {
if w.TsigStatus() == nil {