Skip to content

Commit

Permalink
Bunch of fixes in the lookup function
Browse files Browse the repository at this point in the history
  • Loading branch information
miekg committed Mar 23, 2013
1 parent c4e35ee commit 6e72a14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (u *Unbound) LookupIP(host string) (addrs []net.IP, err error) {
u.ResolveAsync(host, dns.TypeA, dns.ClassINET, c)
u.ResolveAsync(host, dns.TypeAAAA, dns.ClassINET, c)
seen := 0
println("BOE1")
// TODO(miek): timeout?
Wait:
for {
select {
Expand Down
3 changes: 1 addition & 2 deletions tutorial1/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package main

import (
"fmt"
"github.com/miekg/dns"
"github.com/miekg/unbound"
"log"
)
Expand All @@ -14,7 +13,7 @@ func main() {
defer u.Destroy()

u.ResolvConf("/etc/resolv.conf")
r, err := u.Resolve("www.nlnetlabs.nl.", dns.TypeA, dns.ClassINET)
r, err := u.LookupHost("www.nlnetlabs.nl")
if err != nil {
log.Fatalf("error %s\n", err.Error())
}
Expand Down
6 changes: 3 additions & 3 deletions unbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (u *Unbound) Destroy() {

// ResolvConf wraps Unbound's ub_ctx_resolvconf.
func (u *Unbound) ResolvConf(fname string) error {
cfname := C.CString(dns.Fqdn(fname))
cfname := C.CString(fname)
defer C.free(unsafe.Pointer(cfname))
i := C.ub_ctx_resolvconf(u.ctx, cfname)
return newError(int(i))
Expand Down Expand Up @@ -273,8 +273,8 @@ func (u *Unbound) Resolve(name string, rrtype, rrclass uint16) (*Result, error)
func (u *Unbound) ResolveAsync(name string, rrtype, rrclass uint16, c chan *ResultError) {
go func() {
r, e := u.Resolve(name, rrtype, rrclass)
c <- &ResultError{r, e}
}()
c <- &ResultError{r, e}
}()
return
}

Expand Down

0 comments on commit 6e72a14

Please sign in to comment.