debugging

This commit is contained in:
Miek Gieben 2011-03-20 20:16:10 +01:00
parent b1f63f57c4
commit ab035e636f
2 changed files with 4 additions and 3 deletions

2
dns.go
View File

@ -207,7 +207,9 @@ func (d *Conn) Exchange(request []byte, nosend bool) (reply []byte, err os.Error
reply = make([]byte, DefaultMsgSize)
}
n, err = d.Read(reply)
println("READ ", n)
if err != nil {
println(err.String())
return nil, err
}
reply = reply[:n]

5
msg.go
View File

@ -16,7 +16,7 @@ package dns
import (
"os"
"fmt"
// "fmt"
"reflect"
"net"
"rand"
@ -210,7 +210,6 @@ func unpackDomainName(msg []byte, off int) (s string, off1 int, ok bool) {
Loop:
for {
if off >= len(msg) {
println(off, len(msg))
return "", len(msg), false
}
c := int(msg[off])
@ -658,7 +657,7 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
case "domain-name":
s, off, ok = unpackDomainName(msg, off)
if !ok {
fmt.Fprintf(os.Stderr, "dns: failure unpacking domain-name")
//fmt.Fprintf(os.Stderr, "dns: failure unpacking domain-name")
return len(msg), false
}
case "size-base32":