This commit is contained in:
Miek Gieben 2012-09-10 20:51:19 +02:00
parent d78c870779
commit 3a6edfa2c9
5 changed files with 13 additions and 15 deletions

View File

@ -142,7 +142,7 @@ func TestCompressLenght(t *testing.T) {
m.SetQuestion("miek.nl", TypeMX)
ul := m.Len()
m.Compress = true
if ul != m.Len(){
if ul != m.Len() {
t.Fatalf("Should be equal")
}
}

14
msg.go
View File

@ -222,7 +222,7 @@ func PackDomainName(s string, msg []byte, off int, compression map[string]int, c
// Emit sequence of counted strings, chopping at dots.
begin := 0
bs := []byte(s)
// ls := len(bs)
// ls := len(bs)
lens := ls
for i := 0; i < ls; i++ {
if bs[i] == '\\' {
@ -247,18 +247,18 @@ func PackDomainName(s string, msg []byte, off int, compression map[string]int, c
off++
// TODO(mg): because of the new check above, this can go. But
// just leave it as is for the moment.
// if off > lenmsg {
// return lenmsg, false
// }
// if off > lenmsg {
// return lenmsg, false
// }
for j := begin; j < i; j++ {
if off+1 > len(msg) {
return lenmsg, false
}
msg[off] = bs[j]
off++
// if off > lenmsg {
// return lenmsg, false
// }
// if off > lenmsg {
// return lenmsg, false
// }
}
// Dont try to compress '.'
if compression != nil && string(bs[begin:]) != ".'" {

2
xfr.go
View File

@ -141,8 +141,6 @@ func checkXfrSOA(in *Msg, first bool) bool {
return false
}
// XfrSend performs an outgoing [AI]xfr depending on the request message. The
// caller is responsible for sending the correct sequence of RR sets through
// the channel c. For reasons of symmetry XfrToken is re-used.