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) reply = make([]byte, DefaultMsgSize)
} }
n, err = d.Read(reply) n, err = d.Read(reply)
println("READ ", n)
if err != nil { if err != nil {
println(err.String())
return nil, err return nil, err
} }
reply = reply[:n] reply = reply[:n]

5
msg.go
View File

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