mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 18:23:25 -05:00
La context (#521)
* middleware/proxy: give Exchange a context Make context.Context the first paramater in the Exchange method. This is inline with all other query functions. * up the version
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
@@ -24,7 +25,7 @@ func (d *dnsEx) OnShutdown(p *Proxy) error { return nil }
|
||||
func (d *dnsEx) OnStartup(p *Proxy) error { return nil }
|
||||
|
||||
// Exchange implements the Exchanger interface.
|
||||
func (d *dnsEx) Exchange(addr string, state request.Request) (*dns.Msg, error) {
|
||||
func (d *dnsEx) Exchange(ctx context.Context, addr string, state request.Request) (*dns.Msg, error) {
|
||||
co, err := net.DialTimeout(state.Proto(), addr, d.Timeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user