test multiple messages

This commit is contained in:
Miek Gieben 2011-09-11 17:01:55 +02:00
parent 1f03789dcb
commit d814a20623
2 changed files with 26 additions and 6 deletions

View File

@ -76,7 +76,6 @@ func TestClientTsigAXFR(t *testing.T) {
secrets := make(map[string]string)
secrets["axfr."] = "so6ZGir4GPAqINNh9U5c3A=="
println(m.String())
c := NewClient()
c.Net = "tcp"
c.TsigSecret = secrets
@ -87,9 +86,28 @@ func TestClientTsigAXFR(t *testing.T) {
}
for {
ex := <-c.ReplyChan
println(ex.Reply.String())
println(ex.Error.String())
if ex.Error != nil {
t.Log(ex.Reply.String())
if ex.Error == ErrXfrLast {
break
}
}
}
func TestClientAXFRMultipleMessages(t *testing.T) {
m := new(Msg)
m.SetAxfr("dnsex.nl.")
c := NewClient()
c.Net = "tcp"
if err := c.XfrReceive(m, "85.223.71.124:53"); err != nil {
t.Log("Failed to setup axfr" + err.String())
t.Fail()
}
for {
ex := <-c.ReplyChan
t.Log(ex.Reply.String())
if ex.Error == ErrXfrLast {
break
}
}

6
xfr.go
View File

@ -41,7 +41,10 @@ func (w *reply) axfrReceive() {
w.Client().ReplyChan <- &Exchange{w.req, in, err}
return
}
/* id check */
if w.req.Id != in.Id {
w.Client().ReplyChan <- &Exchange{w.req, in, ErrId}
return
}
if first {
if !checkXfrSOA(in, true) {
@ -74,7 +77,6 @@ func (w *reply) ixfrReceive() {
w.Client().ReplyChan <- &Exchange{w.req, in, err}
return
}
if w.req.Id != in.Id {
w.Client().ReplyChan <- &Exchange{w.req, in, ErrId}
return