mirror of https://github.com/Dreamacro/clash.git
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()
|
||||
if expireTime.Before(now) {
|
||||
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 {
|
||||
// updating TTL by subtracting common delta time from each DNS record
|
||||
updateMsgTTL(msg, uint32(time.Until(expireTime).Seconds()))
|
||||
|
|
Loading…
Reference in New Issue