Skip to content

Commit

Permalink
timeout instead deadline
Browse files Browse the repository at this point in the history
  • Loading branch information
semihalev committed May 4, 2020
1 parent 545de26 commit a76ce1c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions middleware/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,9 @@ func (r *Resolver) newDialer(ctx context.Context, proto string, mode authcache.M
d = &net.Dialer{}

if deadline, ok := ctx.Deadline(); ok {
d.Timeout = time.Until(deadline)
d.Deadline = deadline
} else {
d.Timeout = r.cfg.ConnectTimeout.Duration
d.Deadline = time.Now().Add(r.cfg.ConnectTimeout.Duration)
}

if mode == authcache.IPv4 {
Expand Down Expand Up @@ -883,9 +883,6 @@ func (r *Resolver) lookupNSAddrV4(ctx context.Context, proto string, qname strin
r.lqueue.Add(key)
defer r.lqueue.Done(key)

ctx, cancel := context.WithDeadline(ctx, time.Now().Add(time.Second))
defer cancel()

nsres, err := dnsutil.ExchangeInternal(ctx, proto, nsReq)
if err != nil {
return addrs, fmt.Errorf("nameserver ipv4 address lookup failed for %s (%v)", qname, err)
Expand Down

0 comments on commit a76ce1c

Please sign in to comment.