Fix: aysnc exchange with new context (#2788)
This commit is contained in:
parent
13d9e960f7
commit
18c666a1ab
@ -141,7 +141,11 @@ func (r *Resolver) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, e
|
|||||||
msg = cache.(*D.Msg).Copy()
|
msg = cache.(*D.Msg).Copy()
|
||||||
if expireTime.Before(now) {
|
if expireTime.Before(now) {
|
||||||
setMsgTTL(msg, uint32(1)) // Continue fetch
|
setMsgTTL(msg, uint32(1)) // Continue fetch
|
||||||
go r.exchangeWithoutCache(ctx, m)
|
go func() {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), resolver.DefaultDNSTimeout)
|
||||||
|
r.exchangeWithoutCache(ctx, m)
|
||||||
|
cancel()
|
||||||
|
}()
|
||||||
} else {
|
} else {
|
||||||
// updating TTL by subtracting common delta time from each DNS record
|
// updating TTL by subtracting common delta time from each DNS record
|
||||||
updateMsgTTL(msg, uint32(time.Until(expireTime).Seconds()))
|
updateMsgTTL(msg, uint32(time.Until(expireTime).Seconds()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user