mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-04 15:55:32 +00:00
CacheZoneManager: Updated Query() to use FindZone call only when its required to find closest name servers else it will use TryGet to directly get the value from tree.
This commit is contained in:
@@ -341,7 +341,20 @@ namespace DnsServerCore.Dns.ZoneManagers
|
||||
{
|
||||
DnsQuestionRecord question = request.Question[0];
|
||||
|
||||
CacheZone zone = _root.FindZone(question.Name, out CacheZone closest, out CacheZone delegation);
|
||||
CacheZone zone;
|
||||
CacheZone closest = null;
|
||||
CacheZone delegation = null;
|
||||
|
||||
if (findClosestNameServers)
|
||||
{
|
||||
zone = _root.FindZone(question.Name, out closest, out delegation);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_root.TryGet(question.Name, out zone))
|
||||
_ = _root.FindZone(question.Name, out closest, out _); //zone not found; attempt to find closest
|
||||
}
|
||||
|
||||
if (zone is not null)
|
||||
{
|
||||
//zone found
|
||||
|
||||
Reference in New Issue
Block a user