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

2
xfr.go
View File

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