Re-add ExchangeConn

ExchangeConn is back, but with a warning. Other various improvements.
This commit is contained in:
Miek Gieben 2013-10-12 12:44:02 +01:00
parent 97603e3f62
commit 7691523300
2 changed files with 12 additions and 20 deletions

View File

@ -54,8 +54,19 @@ func Exchange(m *Msg, a string) (r *Msg, err error) {
return r, err
}
// ExchangeConn performs a sync
// ExchangeConn performs a synchronous query. It sends the message m via the connection
// c and waits for a reply. The connection c is not closed by ExchangeConn.
// This function is going away, but can easily be mimicked:
//
// co := new(dns.Conn)
// co.Conn = c // c is your net.Conn
// co.WriteMsg(m)
// in, _ := co.ReadMsg()
//
func ExchangeConn(c net.Conn, m *Msg) (r *Msg, err error) {
println("dns: this function is deprecated")
co := new(Conn)
co.Conn = c
if err = co.WriteMsg(m); err != nil {
return nil, err
}

19
xfr.go
View File

@ -224,22 +224,3 @@ func isSOALast(in *Msg) bool {
}
return false
}
/*
// Close implements the net.Conn Close method.
func (t *Transfer) Close() error { return t.Conn.Close() }
// LocalAddr implements the net.Conn LocalAddr method.
func (t *Transfer) LocalAddr() net.Addr { return t.Conn.LocalAddr() }
// RemoteAddr implements the net.Conn RemoteAddr method.
func (t *Transfer) RemoteAddr() net.Addr { return t.Conn.RemoteAddr() }
// SetDeadline implements the net.Conn SetDeadline method.
func (t *Transfer) SetDeadline(t1 time.Time) error { return t.Conn.SetDeadline(t1) }
// SetReadDeadline implements the net.Conn SetReadDeadline method.
func (t *Transfer) SetReadDeadline(t1 time.Time) error { return t.Conn.SetReadDeadline(t1) }
// SetWriteDeadline implements the net.Conn SetWriteDeadline method.
func (t *Transfer) SetWriteDeadline(t1 time.Time) error { return t.Conn.SetWriteDeadline(t1) }
*/