Need to work even harder to fix the length, but this is much better

This commit is contained in:
Miek Gieben 2012-01-10 10:46:55 +01:00
parent bacfa5a80c
commit 3b30c6e0b5
1 changed files with 2 additions and 4 deletions

6
msg.go
View File

@ -975,10 +975,8 @@ func (dns *Msg) Pack() (msg []byte, ok bool) {
dh.Nscount = uint16(len(ns))
dh.Arcount = uint16(len(extra))
// Could work harder to calculate message size,
// but this is far more than we need and not
// big enough to hurt the allocator.
msg = make([]byte, DefaultMsgSize) // TODO, calculate REAL size
// TODO: still too much, but better than 64K
msg = make([]byte, dns.Len()*8)
// Pack it in: header and then the pieces.
off := 0