slight updates to the TODO
This commit is contained in:
parent
19bf874769
commit
bec4153541
|
@ -21,7 +21,6 @@ things that need to be fixed.
|
|||
a major memory saver;
|
||||
* Check base64/base32/hex validity when parsing RRs;
|
||||
* Include os.Error in ParseError too? (more info).
|
||||
* zone.Nxt needs to be differently sorted than the default
|
||||
* Split up the package? An idea might be:
|
||||
dns/zone -- contains all zone parsing
|
||||
dns/server -- server side stuff
|
||||
|
|
|
@ -186,6 +186,7 @@ func ListenAndQuery(c chan *Request, handler QueryHandler) {
|
|||
// Write returns the original question and the answer on the reply channel of the
|
||||
// client.
|
||||
func (w *reply) Write(m *Msg) {
|
||||
// Check if nil??
|
||||
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: m}
|
||||
}
|
||||
|
||||
|
|
6
dns.go
6
dns.go
|
@ -46,6 +46,7 @@ package dns
|
|||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
@ -146,8 +147,9 @@ func (s RRset) Ok() bool {
|
|||
|
||||
// Exchange is used in communicating with the resolver.
|
||||
type Exchange struct {
|
||||
Request *Msg // The question sent.
|
||||
Reply *Msg // The answer to the question that was sent.
|
||||
Request *Msg // The question sent.
|
||||
Reply *Msg // The answer to the question that was sent.
|
||||
Error os.Error // If something when wrong, this contains the error.
|
||||
}
|
||||
|
||||
// DNS resource records.
|
||||
|
|
35
xfr.go
35
xfr.go
|
@ -7,55 +7,54 @@ import (
|
|||
// Perform an incoming Ixfr or Axfr. If the message q's question
|
||||
// section contains an AXFR type an Axfr is performed. If q's question
|
||||
// section contains an IXFR type an Ixfr is performed.
|
||||
func (c *Client) XfrReceive(q *Msg, a string) ([]*Msg, os.Error) {
|
||||
// Each message will be send along the Client's reply channel as it
|
||||
// is received.
|
||||
func (c *Client) XfrReceive(q *Msg, a string) os.Error {
|
||||
w := new(reply)
|
||||
w.client = c
|
||||
w.addr = a
|
||||
w.req = q // is this needed TODO(mg)
|
||||
w.req = q
|
||||
|
||||
if err := w.Send(q); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
// conn should be set now
|
||||
switch q.Question[0].Qtype {
|
||||
case TypeAXFR:
|
||||
return w.axfrReceive()
|
||||
go w.axfrReceive()
|
||||
case TypeIXFR:
|
||||
// return w.ixfrReceive()
|
||||
// go w.ixfrReceive()
|
||||
}
|
||||
panic("not reached")
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *reply) axfrReceive() ([]*Msg, os.Error) {
|
||||
axfr := make([]*Msg, 0) // use append ALL the time?
|
||||
func (w *reply) axfrReceive() {
|
||||
first := true
|
||||
for {
|
||||
in, err := w.Receive()
|
||||
axfr = append(axfr, in)
|
||||
if err != nil {
|
||||
return axfr, err
|
||||
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: in, Error: err}
|
||||
return
|
||||
}
|
||||
|
||||
if first {
|
||||
if !checkXfrSOA(in, true) {
|
||||
return axfr, ErrXfrSoa
|
||||
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: in, Error: ErrXfrSoa}
|
||||
return
|
||||
}
|
||||
first = !first
|
||||
}
|
||||
|
||||
if !first {
|
||||
w.tsigTimersOnly = true // Subsequent envelopes use this.
|
||||
if !checkXfrSOA(in, false) {
|
||||
// Soa record not the last one
|
||||
continue
|
||||
} else {
|
||||
return axfr, nil
|
||||
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: in}
|
||||
if checkXfrSOA(in, false) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
panic("not reached")
|
||||
return nil, nil
|
||||
return
|
||||
}
|
||||
/*
|
||||
|
||||
|
|
Loading…
Reference in New Issue