cosmetics ( i hope)

This commit is contained in:
UbitUmarov
2020-08-07 22:10:53 +01:00
parent af3581ba2e
commit fb54ca39d1
15 changed files with 353 additions and 436 deletions

View File

@@ -95,9 +95,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private object m_httpListLock = new object();
private readonly object m_httpListLock = new object();
private int m_httpTimeout = 30000;
private string m_name = "HttpScriptRequests";
private readonly string m_name = "HttpScriptRequests";
private OutboundUrlFilter m_outboundUrlFilter;
private string m_proxyurl = "";
@@ -135,11 +135,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public bool CheckThrottle(uint localID, UUID ownerID)
{
ThrottleData th;
double now = Util.GetTimeStamp();
bool ret;
if (m_RequestsThrottle.TryGetValue(localID, out th))
if (m_RequestsThrottle.TryGetValue(localID, out ThrottleData th))
{
double delta = now - th.lastTime;
th.lastTime = now;
@@ -353,8 +352,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public IServiceRequest GetNextCompletedRequest()
{
HttpRequestClass req;
if(m_CompletedRequests.TryDequeue(out req))
if(m_CompletedRequests.TryDequeue(out HttpRequestClass req))
return req;
return null;
@@ -364,8 +362,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
lock (m_httpListLock)
{
HttpRequestClass tmpReq;
if (m_pendingRequests.TryGetValue(reqId, out tmpReq))
if (m_pendingRequests.TryGetValue(reqId, out HttpRequestClass tmpReq))
{
tmpReq.Stop();
m_pendingRequests.Remove(reqId);
@@ -410,13 +407,15 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
// First instance sets this up for all sims
if (ThreadPool == null)
{
STPStartInfo startInfo = new STPStartInfo();
startInfo.IdleTimeout = 2000;
startInfo.MaxWorkerThreads = maxThreads;
startInfo.MinWorkerThreads = 0;
startInfo.ThreadPriority = ThreadPriority.BelowNormal;
startInfo.StartSuspended = true;
startInfo.ThreadPoolName = "ScriptsHttpReq";
STPStartInfo startInfo = new STPStartInfo()
{
IdleTimeout = 2000,
MaxWorkerThreads = maxThreads,
MinWorkerThreads = 0,
ThreadPriority = ThreadPriority.Normal,
StartSuspended = true,
ThreadPoolName = "ScriptsHttpReq"
};
ThreadPool = new SmartThreadPool(startInfo);
ThreadPool.Start();
@@ -540,7 +539,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
// We may want to ignore SSL
if (sender is HttpWebRequest)
{
HttpWebRequest Request = (HttpWebRequest)sender;
HttpWebRequest Request = sender as HttpWebRequest;
ServicePoint sp = Request.ServicePoint;
// We don't case about encryption, get out of here