mirror of
https://github.com/miekg/dns.git
synced 2025-10-16 04:11:07 +02:00
remove err from the function and kill the println
This commit is contained in:
parent
04a1ff15cf
commit
e0fb2abe85
27
resolver.go
27
resolver.go
@ -112,7 +112,6 @@ type Xfr struct {
|
|||||||
// Channel m is closed when the IXFR ends.
|
// Channel m is closed when the IXFR ends.
|
||||||
func (res *Resolver) Ixfr(q *Msg, m chan Xfr) {
|
func (res *Resolver) Ixfr(q *Msg, m chan Xfr) {
|
||||||
var port string
|
var port string
|
||||||
var err os.Error
|
|
||||||
var in *Msg
|
var in *Msg
|
||||||
var x Xfr
|
var x Xfr
|
||||||
if res.Port == "" {
|
if res.Port == "" {
|
||||||
@ -124,8 +123,6 @@ func (res *Resolver) Ixfr(q *Msg, m chan Xfr) {
|
|||||||
res.Rtt = make(map[string]int64)
|
res.Rtt = make(map[string]int64)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = err // TODO(mg)
|
|
||||||
|
|
||||||
if q.Id == 0 {
|
if q.Id == 0 {
|
||||||
q.Id = Id()
|
q.Id = Id()
|
||||||
}
|
}
|
||||||
@ -139,9 +136,8 @@ func (res *Resolver) Ixfr(q *Msg, m chan Xfr) {
|
|||||||
Server:
|
Server:
|
||||||
for i := 0; i < len(res.Servers); i++ {
|
for i := 0; i < len(res.Servers); i++ {
|
||||||
server := res.Servers[i] + ":" + port
|
server := res.Servers[i] + ":" + port
|
||||||
c, cerr := net.Dial("tcp", "", server)
|
c, err := net.Dial("tcp", "", server)
|
||||||
if cerr != nil {
|
if err != nil {
|
||||||
err = cerr
|
|
||||||
continue Server
|
continue Server
|
||||||
}
|
}
|
||||||
first := true
|
first := true
|
||||||
@ -150,14 +146,13 @@ Server:
|
|||||||
defer c.Close()
|
defer c.Close()
|
||||||
for {
|
for {
|
||||||
if first {
|
if first {
|
||||||
in, cerr = exchangeTCP(c, sending, res, true)
|
in, err = exchangeTCP(c, sending, res, true)
|
||||||
} else {
|
} else {
|
||||||
in, err = exchangeTCP(c, sending, res, false)
|
in, err = exchangeTCP(c, sending, res, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cerr != nil {
|
if err != nil {
|
||||||
// Failed to send, try the next
|
// Failed to send, try the next
|
||||||
err = cerr
|
|
||||||
c.Close()
|
c.Close()
|
||||||
continue Server
|
continue Server
|
||||||
}
|
}
|
||||||
@ -223,7 +218,6 @@ Server:
|
|||||||
// The channel is closed to signal the end of the AXFR.
|
// The channel is closed to signal the end of the AXFR.
|
||||||
func (res *Resolver) Axfr(q *Msg, m chan Xfr) {
|
func (res *Resolver) Axfr(q *Msg, m chan Xfr) {
|
||||||
var port string
|
var port string
|
||||||
var err os.Error
|
|
||||||
var in *Msg
|
var in *Msg
|
||||||
if res.Port == "" {
|
if res.Port == "" {
|
||||||
port = "53"
|
port = "53"
|
||||||
@ -234,8 +228,6 @@ func (res *Resolver) Axfr(q *Msg, m chan Xfr) {
|
|||||||
res.Rtt = make(map[string]int64)
|
res.Rtt = make(map[string]int64)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = err // TODO(mg)
|
|
||||||
|
|
||||||
if q.Id == 0 {
|
if q.Id == 0 {
|
||||||
q.Id = Id()
|
q.Id = Id()
|
||||||
}
|
}
|
||||||
@ -248,25 +240,22 @@ func (res *Resolver) Axfr(q *Msg, m chan Xfr) {
|
|||||||
Server:
|
Server:
|
||||||
for i := 0; i < len(res.Servers); i++ {
|
for i := 0; i < len(res.Servers); i++ {
|
||||||
server := res.Servers[i] + ":" + port
|
server := res.Servers[i] + ":" + port
|
||||||
c, cerr := net.Dial("tcp", "", server)
|
c, err := net.Dial("tcp", "", server)
|
||||||
if cerr != nil {
|
if err != nil {
|
||||||
err = cerr
|
|
||||||
continue Server
|
continue Server
|
||||||
}
|
}
|
||||||
first := true
|
first := true
|
||||||
defer c.Close() // TODO(mg): if not open?
|
defer c.Close() // TODO(mg): if not open?
|
||||||
for {
|
for {
|
||||||
if first {
|
if first {
|
||||||
in, cerr = exchangeTCP(c, sending, res, true)
|
in, err = exchangeTCP(c, sending, res, true)
|
||||||
} else {
|
} else {
|
||||||
in, err = exchangeTCP(c, sending, res, false)
|
in, err = exchangeTCP(c, sending, res, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cerr != nil {
|
if err != nil {
|
||||||
// Failed to send, try the next
|
// Failed to send, try the next
|
||||||
err = cerr
|
|
||||||
c.Close()
|
c.Close()
|
||||||
println("AGIAIN")
|
|
||||||
continue Server
|
continue Server
|
||||||
}
|
}
|
||||||
if in.Id != q.Id {
|
if in.Id != q.Id {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user