From 5ab6e47c9fff67acd0d221bc16a47044dada76ff Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 23 Jan 2022 17:08:59 +0530 Subject: [PATCH] SecondaryZone: resolving name server address internally in CreateAsync(). Removed WithTimeout() for direct query. --- DnsServerCore/Dns/Zones/SecondaryZone.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DnsServerCore/Dns/Zones/SecondaryZone.cs b/DnsServerCore/Dns/Zones/SecondaryZone.cs index 12f3aa10..74d02c10 100644 --- a/DnsServerCore/Dns/Zones/SecondaryZone.cs +++ b/DnsServerCore/Dns/Zones/SecondaryZone.cs @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Net; using System.Threading; using System.Threading.Tasks; -using TechnitiumLibrary; using TechnitiumLibrary.Net.Dns; using TechnitiumLibrary.Net.Dns.ResourceRecords; @@ -124,12 +123,18 @@ namespace DnsServerCore.Dns.Zones if (primaryNameServerAddresses == null) { - soaResponse = await secondaryZone._dnsServer.DirectQueryAsync(soaQuestion).WithTimeout(2000); + soaResponse = await secondaryZone._dnsServer.DirectQueryAsync(soaQuestion); } else { DnsClient dnsClient = new DnsClient(primaryNameServerAddresses); + foreach (NameServerAddress nameServerAddress in dnsClient.Servers) + { + if (nameServerAddress.IsIPEndPointStale) + await nameServerAddress.ResolveIPAddressAsync(secondaryZone._dnsServer, secondaryZone._dnsServer.PreferIPv6); + } + dnsClient.Proxy = secondaryZone._dnsServer.Proxy; dnsClient.PreferIPv6 = secondaryZone._dnsServer.PreferIPv6;