Skip to content

Commit

Permalink
Fix ExchangeCache
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed May 15, 2024
1 parent b680c91 commit 7fecf77
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,12 @@ func (c *Client) ExchangeCache(ctx context.Context, message *dns.Msg) (*dns.Msg,
return nil, false
}
question := message.Question[0]
disableCache := c.disableCache || DisableCacheFromContext(ctx)
_, clientSubnetLoaded := transportNameFromContext(ctx)
isSimpleRequest := len(message.Question) == 1 &&
len(message.Ns) == 0 &&
len(message.Extra) == 0 &&
!clientSubnetLoaded
disableCache := !isSimpleRequest || c.disableCache || DisableCacheFromContext(ctx)
if disableCache {
return nil, false
}
Expand Down

0 comments on commit 7fecf77

Please sign in to comment.