Make the DNS cache timeout configurable.

In containerized environments, DNS is simulated. It can change several
times per second as containers move around. The hardcoded timeout was
too long for a container environment.
0.9.1.0-post-fixes
Melanie 2019-08-09 12:06:33 +01:00
parent f332f3fc41
commit c9b7ec2af9
3 changed files with 8 additions and 3 deletions

View File

@ -84,7 +84,7 @@ namespace OpenSim
ServicePointManager.DefaultConnectionLimit = 12;
}
try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
try { ServicePointManager.DnsRefreshTimeout = 5000; } catch { }
ServicePointManager.Expect100Continue = false;
ServicePointManager.UseNagleAlgorithm = false;

View File

@ -37,6 +37,7 @@ using System.Runtime;
using System.Text;
using System.Text.RegularExpressions;
using System.Timers;
using System.Net;
using log4net;
using NDesk.Options;
using Nini.Config;
@ -119,6 +120,9 @@ namespace OpenSim
stpMinThreads = startupConfig.GetInt("MinPoolThreads", 2 );
stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 25);
m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) ");
int dnsTimeout = startupConfig.GetInt("DnsTimeout", 30000);
try { ServicePointManager.DnsRefreshTimeout = dnsTimeout; } catch { }
}
if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)

View File

@ -85,8 +85,6 @@ namespace OpenSim.Server
ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
string registryLocation;
@ -98,6 +96,9 @@ namespace OpenSim.Server
throw new Exception("Configuration error");
}
int dnsTimeout = serverConfig.GetInt("DnsTimeout", 30000);
try { ServicePointManager.DnsRefreshTimeout = dnsTimeout; } catch { }
m_NoVerifyCertChain = serverConfig.GetBoolean("NoVerifyCertChain", m_NoVerifyCertChain);
m_NoVerifyCertHostname = serverConfig.GetBoolean("NoVerifyCertHostname", m_NoVerifyCertHostname);