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

@@ -241,8 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests
sceneSouth.Update(4);
sp1.DrawDistance += 64;
sp2.DrawDistance += 64;
sceneNorth.Update(2);
sceneSouth.Update(2);
sceneNorth.Update(4);
sceneSouth.Update(4);
// Check child positions are correct.
Assert.AreEqual(

View File

@@ -290,8 +290,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else
connector = new UserAgentServiceConnector(userAgentDriver);
GridRegion source = new GridRegion(Scene.RegionInfo);
source.RawServerURI = m_GatekeeperURI;
GridRegion source = new GridRegion(Scene.RegionInfo)
{
RawServerURI = m_GatekeeperURI
};
bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason);
logout = success; // flag for later logout from this grid; this is an HG TP
@@ -578,8 +580,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);
string message;
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out message);
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out string message);
if (finalDestination != null)
{
@@ -793,19 +794,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private GridRegion MakeGateKeeperRegion(string wantedURI)
{
Uri uri;
if(!Uri.TryCreate(wantedURI, UriKind.Absolute, out uri))
if(!Uri.TryCreate(wantedURI, UriKind.Absolute, out Uri uri))
return null;
GridRegion region = new GridRegion();
region.ExternalHostName = uri.Host;
region.HttpPort = (uint)uri.Port;
region.ServerURI = wantedURI; //uri.AbsoluteUri for some reason default ports are needed
region.RegionName = string.Empty;
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
region.RegionFlags = OpenSim.Framework.RegionFlags.Hyperlink;
return region;
return new GridRegion()
{
ExternalHostName = uri.Host,
HttpPort = (uint)uri.Port,
ServerURI = wantedURI, //uri.AbsoluteUri for some reason default ports are needed
RegionName = string.Empty,
InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0),
RegionFlags = OpenSim.Framework.RegionFlags.Hyperlink
};
}
}
}

View File

@@ -323,7 +323,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// debugging we may want to simply report the failure if we can tell this is due to a failure
// with a particular asset and not a destination network failure where all asset posts will fail (and
// generate large amounts of log spam).
throw e;
throw;
}
}
StringBuilder sb = null;

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

View File

@@ -194,10 +194,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
if (m_scenes.ContainsKey(destination.RegionID))
if (m_scenes.TryGetValue(destination.RegionID, out Scene destScene))
{
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, source, out reason);
return destScene.NewUserConnection(aCircuit, teleportFlags, source, out reason);
}
reason = "Did not find region " + destination.RegionName;

View File

@@ -39,7 +39,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
private AssetBase m_asset;
public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient);
public event TerrainUploadComplete TerrainUploadDone;
//private string m_description = String.Empty;
@@ -48,15 +47,16 @@ namespace OpenSim.Region.CoreModules.World.Estate
private sbyte type = 0;
public ulong mXferID;
private TerrainUploadComplete handlerTerrainUploadDone;
public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
{
m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId.ToString());
m_asset.Data = new byte[0];
m_asset.Description = "empty";
m_asset.Local = true;
m_asset.Temporary = true;
m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId.ToString())
{
Data = new byte[0],
Description = "empty",
Local = true,
Temporary = true
};
}
public ulong XferID
@@ -108,11 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void SendCompleteMessage(IClientAPI remoteClient)
{
handlerTerrainUploadDone = TerrainUploadDone;
if (handlerTerrainUploadDone != null)
{
handlerTerrainUploadDone(m_asset.Name, m_asset.Data, remoteClient);
}
TerrainUploadDone?.Invoke(m_asset.Name, m_asset.Data, remoteClient);
}
}
}

View File

@@ -1756,7 +1756,7 @@ namespace OpenSim.Region.CoreModules.World.Land
foreach (SceneObjectGroup obj in primsOverMe)
{
if(m_scene.Permissions.CanSellObject(previousOwner,obj, (byte)SaleType.Original))
m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, (byte)SaleType.Original, 0);
}
}
}