MX and NS - DNS timeout fix
This commit is contained in:
parent
a5120e14b2
commit
8a45147d44
1 changed files with 19 additions and 4 deletions
|
@ -26,6 +26,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
private const string MxRecordPattern = @"mail exchanger = (.+)";
|
private const string MxRecordPattern = @"mail exchanger = (.+)";
|
||||||
private const string NsRecordPattern = @"nameserver = (.+)";
|
private const string NsRecordPattern = @"nameserver = (.+)";
|
||||||
|
private const string DnsTimeOutMessage = @"dns request timed out";
|
||||||
|
private const int DnsTimeOutRetryCount = 3;
|
||||||
|
|
||||||
public override void DoWork()
|
public override void DoWork()
|
||||||
{
|
{
|
||||||
|
@ -100,8 +102,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
//execute server
|
//execute server
|
||||||
foreach (var dnsServer in dnsServers)
|
foreach (var dnsServer in dnsServers)
|
||||||
{
|
{
|
||||||
var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX);
|
var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX).ToList();
|
||||||
var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS);
|
var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS).ToList();
|
||||||
|
|
||||||
FillRecordData(dnsMxRecords, domain, dnsServer);
|
FillRecordData(dnsMxRecords, domain, dnsServer);
|
||||||
FillRecordData(dnsNsRecords, domain, dnsServer);
|
FillRecordData(dnsNsRecords, domain, dnsServer);
|
||||||
|
@ -311,7 +313,20 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
var args = string.Format("-type={0} {1} {2}", recordType, domain, dnsServer);
|
var args = string.Format("-type={0} {1} {2}", recordType, domain, dnsServer);
|
||||||
|
|
||||||
// execute system command
|
// execute system command
|
||||||
var raw = winServer.ExecuteSystemCommand(command, args);
|
var raw = string.Empty;
|
||||||
|
int triesCount = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
raw = winServer.ExecuteSystemCommand(command, args);
|
||||||
|
}
|
||||||
|
while (raw.ToLowerInvariant().Contains(DnsTimeOutMessage) && ++triesCount < DnsTimeOutRetryCount);
|
||||||
|
|
||||||
|
//timeout check
|
||||||
|
if (raw.ToLowerInvariant().Contains(DnsTimeOutMessage))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var records = ParseNsLookupResult(raw, dnsServer, recordType);
|
var records = ParseNsLookupResult(raw, dnsServer, recordType);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue