From 8010413e645e1aaf655008e216c017943a5d8c76 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 21:06:42 +0000 Subject: [PATCH 01/47] remove some potencial null refs i did add in last days :( --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8ba26e83f9..55d4e39818 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -620,7 +620,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityProps = null; m_killRecord.Clear(); GroupsInView.Clear(); - m_scene = null; +// m_scene = null; can't do this unless checks are added everywhere due to workitems already in pools + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); @@ -4371,7 +4372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ushort timeDilation; - if(m_scene == null) + if(!IsActive) return; timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); @@ -12945,6 +12946,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { + if(!IsActive) + return; + if (m_outPacketsToDrop != null) if (m_outPacketsToDrop.Contains(packet.Type.ToString())) return; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index e85cee2524..0efa7c55cd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -299,10 +299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OnQueueEmpty = null; PendingAcks.Clear(); NeedAcks.Clear(); - NeedAcks = null; - PendingAcks = null; m_nextPackets = null; - m_packetOutboxes = null; } /// From b887b7625e03a3923e8eea72353c878bc1d4b3a9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 21:53:09 +0000 Subject: [PATCH 02/47] change OutPacket drop condition --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 55d4e39818..05a3191047 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12946,12 +12946,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { - if(!IsActive) + if(!m_udpClient.IsConnected) + { + PacketPool.Instance.ReturnPacket(packet); return; + } if (m_outPacketsToDrop != null) + { if (m_outPacketsToDrop.Contains(packet.Type.ToString())) + { + PacketPool.Instance.ReturnPacket(packet); return; + } + } if (DebugPacketLevel > 0) { From 586c81eecda0193e3403135ad308f8e9887f1456 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 01:49:53 +0000 Subject: [PATCH 03/47] give up on OutPacket drop condition on closing --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 05a3191047..5879e56668 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12946,12 +12946,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { + +/* this is causing packet loss for some reason if(!m_udpClient.IsConnected) { PacketPool.Instance.ReturnPacket(packet); return; } - +*/ if (m_outPacketsToDrop != null) { if (m_outPacketsToDrop.Contains(packet.Type.ToString())) From 200183caf7c3673e914a7b7f30fbb47bc7e92c44 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 02:49:40 +0000 Subject: [PATCH 04/47] HG protocol is still broken for large regions. work around it on teleport via lm --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - .../Framework/EntityTransfer/HGEntityTransferModule.cs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 0efa7c55cd..c804e3305e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -299,7 +299,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OnQueueEmpty = null; PendingAcks.Clear(); NeedAcks.Clear(); - m_nextPackets = null; } /// diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index a9aaf124b9..49307f6ce9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -515,7 +515,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); // Local region? - if (info != null) + // HG link is broken for large regions + // so ignore its information so lms to large regions can work + if (info != null && info.RegionLocY != 0) { Scene.RequestTeleportLocation( remoteClient, info.RegionHandle, lm.Position, From 93d502e0cf5d6822d950a4e29c5d5fea9513f9ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 03:19:19 +0000 Subject: [PATCH 05/47] HG UserAgent, return serverURI --- OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index e112e0e1ff..37feabe8b9 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -139,6 +139,7 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["region_name"] = regInfo.RegionName; hash["hostname"] = regInfo.ExternalHostName; hash["http_port"] = regInfo.HttpPort.ToString(); + hash["server_uri"] = regInfo.ServerURI; hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); hash["position"] = position.ToString(); hash["lookAt"] = lookAt.ToString(); From e2b580e56906f76e74abfdac5a11a1c1bbc31252 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 03:51:38 +0000 Subject: [PATCH 06/47] HG LinkRegion sends region size also --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 6 +++++- OpenSim/Services/HypergridService/GatekeeperService.cs | 8 +++++++- OpenSim/Services/Interfaces/IHypergridServices.cs | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index c7ac9be132..cb15138465 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -70,13 +70,17 @@ namespace OpenSim.Server.Handlers.Hypergrid string imageURL = string.Empty; ulong regionHandle = 0; string reason = string.Empty; + int sizeX = 256; + int sizeY = 256; - bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason); + bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason, out sizeX, out sizeY); Hashtable hash = new Hashtable(); hash["result"] = success.ToString(); hash["uuid"] = regionID.ToString(); hash["handle"] = regionHandle.ToString(); + hash["size_x"] = sizeX; + hash["size_y"] = sizeY; hash["region_image"] = imageURL; hash["external_name"] = externalName; diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 9643a8bd72..41e2b4057f 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -162,10 +162,12 @@ namespace OpenSim.Services.HypergridService exceptions.Add(s.Trim()); } - public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) + public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY) { regionID = UUID.Zero; regionHandle = 0; + sizeX = (int)Constants.RegionSize; + sizeY = (int)Constants.RegionSize; externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); imageURL = string.Empty; reason = string.Empty; @@ -199,6 +201,8 @@ namespace OpenSim.Services.HypergridService regionID = region.RegionID; regionHandle = region.RegionHandle; + sizeX = region.RegionSizeX; + sizeY = region.RegionSizeY; string regionimage = "regionImage" + regionID.ToString(); regionimage = regionimage.Replace("-", ""); @@ -275,6 +279,7 @@ namespace OpenSim.Services.HypergridService if (!am.Success) { + reason = "Login failed: client " + curViewer + " is not allowed"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", curViewer); return false; } @@ -287,6 +292,7 @@ namespace OpenSim.Services.HypergridService if (dm.Success) { + reason = "Login failed: client " + curViewer + " is denied"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", curViewer); return false; } diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 5e012fb173..1815e6cee8 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -36,7 +36,7 @@ namespace OpenSim.Services.Interfaces { public interface IGatekeeperService { - bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); + bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY); /// /// Returns the region a Hypergrid visitor should enter. From 4c2ece3bcb7a28c746ef42b7cc6939571e0ede3b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 04:22:00 +0000 Subject: [PATCH 07/47] HG LinkRegion receive region size also. Useless since olde r gatekeepers dont send it --- .../Hypergrid/GatekeeperServiceConnector.cs | 13 +++++++++++-- OpenSim/Services/GridService/HypergridLinker.cs | 8 ++++++-- OpenSim/Services/LLLoginService/LLLoginService.cs | 5 ++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index aad3bd220a..eef492d4b4 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -73,13 +73,15 @@ namespace OpenSim.Services.Connectors.Hypergrid return "foreignobject/"; } - public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) + public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY) { regionID = UUID.Zero; imageURL = string.Empty; realHandle = 0; externalName = string.Empty; reason = string.Empty; + sizeX = (int)Constants.RegionSize; + sizeY = (int)Constants.RegionSize; Hashtable hash = new Hashtable(); hash["region_name"] = info.RegionName; @@ -134,8 +136,15 @@ namespace OpenSim.Services.Connectors.Hypergrid externalName = (string)hash["external_name"]; //m_log.Debug(">> HERE, externalName: " + externalName); } + if (hash["size_x"] != null) + { + Int32.TryParse((string)hash["size_x"], out sizeX); + } + if (hash["size_y"] != null) + { + Int32.TryParse((string)hash["size_y"], out sizeY); + } } - } catch (Exception e) { diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 2af617a4f4..db33b1a486 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,7 +198,7 @@ namespace OpenSim.Services.GridService mapName = mapName.Trim(); - if (!mapName.StartsWith("http")) + if (!mapName.StartsWith("http") && !!mapName.StartsWith("https")) { // Formats: grid.example.com:8002:region name // grid.example.com:region name @@ -365,7 +365,9 @@ namespace OpenSim.Services.GridService UUID regionID = UUID.Zero; string externalName = string.Empty; string imageURL = string.Empty; - if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) + int sizeX = (int)Constants.RegionSize; + int sizeY = (int)Constants.RegionSize; + if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason, out sizeX, out sizeY)) return false; if (regionID == UUID.Zero) @@ -397,6 +399,8 @@ namespace OpenSim.Services.GridService // } regInfo.RegionID = regionID; + regInfo.RegionSizeX = sizeX; + regInfo.RegionSizeY = sizeY; if (externalName == string.Empty) regInfo.RegionName = regInfo.ServerURI; diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 1ea17b502c..6d63959a2a 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -785,7 +785,10 @@ namespace OpenSim.Services.LLLoginService ulong handle; string imageURL = string.Empty, reason = string.Empty; string message; - if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) + int sizeX = (int)Constants.RegionSize; + int sizeY = (int)Constants.RegionSize; + + if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason, out sizeX, out sizeY)) { string homeURI = null; if (account.ServiceURLs != null && account.ServiceURLs.ContainsKey("HomeURI")) From 902e8019de4c61379e3dc51f506bd4a1af0a9df3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 05:06:50 +0000 Subject: [PATCH 08/47] HG add a small delay before start sending region data --- .../Region/Framework/Scenes/ScenePresence.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2cfdd946f9..7efd9200ed 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2071,14 +2071,13 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); } - if(!gotCrossUpdate) - RotateToLookAt(look); // Tell the client that we're totally ready ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!string.IsNullOrEmpty(m_callbackURI)) { // We cannot sleep here since this would hold up the inbound packet processing thread, as @@ -2107,12 +2106,28 @@ namespace OpenSim.Region.Framework.Scenes // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); // } + m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + + if(m_teleportFlags > 0) //sanity check + gotCrossUpdate = false; + + if(!gotCrossUpdate) + RotateToLookAt(look); + + // start sending terrain patchs if (!gotCrossUpdate && !isNPC) Scene.SendLayerData(ControllingClient); + // HG delay + if((m_teleportFlags & TeleportFlags.ViaHGLogin) != 0) + { + Thread.Sleep(500); + m_log.DebugFormat("[CompleteMovement] HG delay: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + } + m_previusParcelHide = false; m_previusParcelUUID = UUID.Zero; m_currentParcelHide = false; From f1958e9f71f5ba9b8ca088f23df68336a3c7b43c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 13:36:34 +0000 Subject: [PATCH 09/47] revert more object references removal on clients close because 2 many code paths don't have proper abort --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5879e56668..65a341e274 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -606,11 +606,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_scene.CloseAllAgents(CircuitCode); // Disable UDP handling for this client - m_udpClient.Shutdown(); - m_udpClient.OnQueueEmpty -= HandleQueueEmpty; m_udpClient.HasUpdates -= HandleHasUpdates; m_udpClient.OnPacketStats -= PopulateStats; + m_udpClient.Shutdown(); // Shutdown the image manager ImageManager.Close(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c804e3305e..dc8ac3c41c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -288,15 +288,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { m_packetOutboxes[i].Clear(); - m_throttleCategories[i] = null; m_nextPackets[i] = null; } // pull the throttle out of the scene throttle m_throttleClient.Parent.UnregisterRequest(m_throttleClient); - m_throttleClient = null; - OnPacketStats = null; - OnQueueEmpty = null; PendingAcks.Clear(); NeedAcks.Clear(); } From 1d998a770b2c4ce53b0482d1360668ea4142ebe0 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Sun, 20 Nov 2016 13:52:06 +0000 Subject: [PATCH 10/47] Change some minor log messages to debug level in Rest client code. --- OpenSim/Framework/RestClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index ca1939218b..26237deae4 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -430,11 +430,11 @@ namespace OpenSim.Framework using (Stream dst = _request.GetRequestStream()) { - m_log.Info("[REST]: GetRequestStream is ok"); + m_log.Debug("[REST]: GetRequestStream is ok"); byte[] buf = new byte[1024]; int length = src.Read(buf, 0, 1024); - m_log.Info("[REST]: First Read is ok"); + m_log.Debug("[REST]: First Read is ok"); while (length > 0) { dst.Write(buf, 0, length); From 05f70024451e99f8e136499c04d645960a6b5f3a Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Sun, 20 Nov 2016 14:20:54 +0000 Subject: [PATCH 11/47] Include config option to disable stats thread showing read/write stats in console. Keeping default as true to retain current behaviour. Also checked to prevent counters being added to so there wont be any integer overflows over time --- .../Services/FSAssetService/FSAssetService.cs | 30 ++++++++++++++----- bin/Robust.HG.ini.example | 3 ++ bin/Robust.ini.example | 3 ++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs index 9ec2d00a57..7f1446272e 100644 --- a/OpenSim/Services/FSAssetService/FSAssetService.cs +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs @@ -77,6 +77,7 @@ namespace OpenSim.Services.FSAssetService protected int m_missingAssetsFS = 0; protected string m_FSBase; protected bool m_useOsgridFormat = false; + protected bool m_showStats = true; private static bool m_Initialized; private bool m_MainInstance; @@ -186,6 +187,9 @@ namespace OpenSim.Services.FSAssetService m_useOsgridFormat = assetConfig.GetBoolean("UseOsgridFormat", m_useOsgridFormat); + // Default is to show stats to retain original behaviour + m_showStats = assetConfig.GetBoolean("ShowConsoleStats", m_showStats); + if (m_MainInstance) { string loader = assetConfig.GetString("DefaultAssetLoader", string.Empty); @@ -203,8 +207,12 @@ namespace OpenSim.Services.FSAssetService m_WriterThread = new Thread(Writer); m_WriterThread.Start(); - m_StatsThread = new Thread(Stats); - m_StatsThread.Start(); + + if (m_showStats) + { + m_StatsThread = new Thread(Stats); + m_StatsThread.Start(); + } } m_log.Info("[FSASSETS]: FS asset service enabled"); @@ -441,7 +449,7 @@ namespace OpenSim.Services.FSAssetService Store(asset); } } - if (asset == null) + if (asset == null && m_showStats) { // m_log.InfoFormat("[FSASSETS]: Asset {0} not found", id); m_missingAssets++; @@ -469,8 +477,11 @@ namespace OpenSim.Services.FSAssetService } } if (asset == null) - m_missingAssetsFS++; - // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash); + { + if (m_showStats) + m_missingAssetsFS++; + // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash); + } else { // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) @@ -484,10 +495,13 @@ namespace OpenSim.Services.FSAssetService } } - lock (m_statsLock) + if (m_showStats) { - m_readTicks += Environment.TickCount - startTime; - m_readCount++; + lock (m_statsLock) + { + m_readTicks += Environment.TickCount - startTime; + m_readCount++; + } } // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index ad076743d3..c231a8a5ca 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -242,6 +242,9 @@ ;; Reduces DB calls if asset is requested often. Default value 0 will always update access time ;DaysBetweenAccessTimeUpdates = 30 + ;; Should FSAssets print read/write stats to the robust console, default is true + ;ShowConsoleStats = true + ;; FSAssets Custom Database Config (Leave blank to use grids default database configuration) ;StorageProvider = "" ;ConnectionString = "" diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 099d4da247..743b23dbc5 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -204,6 +204,9 @@ ;; Reduces DB calls if asset is requested often. Default value 0 will always update access time ;DaysBetweenAccessTimeUpdates = 30 + ;; Should FSAssets print read/write stats to the robust console, default is true + ;ShowConsoleStats = true + ;; FSAssets Custom Database Config (Leave blank to use grids default database configuration) ;StorageProvider = "" ;ConnectionString = "" From b70e48c8a5e13074480bdd89a810ff8c73dc8afb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 22:09:33 +0000 Subject: [PATCH 12/47] handle HG lm tp to large regions in another way --- .../EntityTransfer/EntityTransferModule.cs | 21 ++++++++++++++----- .../EntityTransfer/HGEntityTransferModule.cs | 4 +--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 71a0e525d2..1161571016 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -594,12 +594,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer uint x = 0, y = 0; Util.RegionHandleToWorldLoc(regionHandle, out x, out y); + GridRegion reg; + + // handle legacy HG. liked regions are mapped into y = 0 and have no size information + // so we can only search by base handle + if( y == 0) + { + reg = gridService.GetRegionByPosition(scope, (int)x, (int)y); + return reg; + } + // Compute the world location we're teleporting to double worldX = (double)x + position.X; double worldY = (double)y + position.Y; // Find the region that contains the position - GridRegion reg = GetRegionContainingWorldLocation(gridService, scope, worldX, worldY); + reg = GetRegionContainingWorldLocation(gridService, scope, worldX, worldY); if (reg != null) { @@ -813,8 +823,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (OutSideViewRange) { m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", - finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); + "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} size {3},{4} needs new child agent for agent {5} from {6}", + finalDestination.RegionName, newRegionX, newRegionY,newSizeX, newSizeY, sp.Name, Scene.Name); //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); #region IP Translation for NAT @@ -2180,8 +2190,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #endregion // NotFoundLocationCache class private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); -// needed for old grid code - protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) { // Since we don't know how big the regions could be, we have to search a very large area @@ -2191,6 +2199,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Given a world position, get the GridRegion info for // the region containing that point. + // for compatibility with old grids it does a scan to find large regions + // 0.9 grids to that + protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py, uint pSizeHint) { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 49307f6ce9..a9aaf124b9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -515,9 +515,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID); // Local region? - // HG link is broken for large regions - // so ignore its information so lms to large regions can work - if (info != null && info.RegionLocY != 0) + if (info != null) { Scene.RequestTeleportLocation( remoteClient, info.RegionHandle, lm.Position, From b2c553b459a8390aaadd8f7c65567b1e557226c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:16:35 +0000 Subject: [PATCH 13/47] work around some warnings --- .../ClientStack/Linden/UDP/LLUDPClient.cs | 1 + .../ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 5 +++++ .../ClientStack/Linden/UDP/TokenBucket.cs | 22 ++++++++++++------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index dc8ac3c41c..9449ffb9dc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -111,6 +111,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// hooked to put more data on the empty queue public event QueueEmpty OnQueueEmpty; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design","CA1009:DeclareEventHandlersCorrectly")] public event Func HasUpdates; /// AgentID for this client diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index af33d17b7e..a868e3aa44 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // if (usePools) // EnablePools(); - DisablePools(); + base.DisablePools(); } public void Start() diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 7171974db3..4d726b43dd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -179,6 +179,11 @@ namespace OpenMetaverse // m_dropRandomGenerator = new Random(); } + ~OpenSimUDPBase() + { + if(m_udpSocket !=null) + try { m_udpSocket.Close(); } catch { } + } /// /// Start inbound UDP packet handling. /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index d4603f80a5..cac57b221e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -97,7 +97,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected float m_burst; - public virtual float MaxDripRate { get; set; } + protected float m_maxDripRate = 0; + public virtual float MaxDripRate + { + get { return m_maxDripRate; } + set { m_maxDripRate = value; } + } public float RequestedBurst { @@ -134,7 +139,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// the system tick interval (typically around 15-22ms) protected float m_dripRate; - public virtual float RequestedDripRate + public float RequestedDripRate { get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } set { @@ -146,7 +151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public virtual float DripRate + public float DripRate { get { float rate = Math.Min(RequestedDripRate,TotalDripRequest); @@ -344,7 +349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // greater than this. // - protected float m_maxDripRate = 0; public override float MaxDripRate { get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } @@ -359,7 +363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // Adjust drip rate in response to network conditions. // - public virtual float AdjustedDripRate + public float AdjustedDripRate { get { return m_dripRate; } set @@ -380,12 +384,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_enabled = enabled; - MaxDripRate = maxDripRate; + m_maxDripRate = (maxDripRate == 0 ? m_totalDripRequest : Math.Max(maxDripRate, m_minimumFlow)); if (enabled) - AdjustedDripRate = m_maxDripRate * .5f; + m_dripRate = m_maxDripRate * .5f; else - AdjustedDripRate = m_maxDripRate; + m_dripRate = m_maxDripRate; + if (m_parent != null) + m_parent.RegisterRequest(this, m_dripRate); } /// From f794ab1a6702cdfc073eec17168c280891b941b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:22:01 +0000 Subject: [PATCH 14/47] remove something VS decided to add --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9449ffb9dc..dc8ac3c41c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -111,7 +111,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// hooked to put more data on the empty queue public event QueueEmpty OnQueueEmpty; - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design","CA1009:DeclareEventHandlersCorrectly")] public event Func HasUpdates; /// AgentID for this client From bced98d6e9b5fe08fd50a1be88c10a83063c309e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:47:09 +0000 Subject: [PATCH 15/47] work around some more warnings --- .../AgentPreferences/RemoteAgentPreferencesServiceConnector.cs | 2 +- .../Connectors/AgentPreferences/AgentPreferencesConnector.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs index ad9544ad30..a827c4c306 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.AgentPreferences get { return "RemoteAgentPreferencesServicesConnector"; } } - public override void Initialise(IConfigSource source) + public new void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) diff --git a/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs index 1dbc0c8fe2..0e72c8bedd 100644 --- a/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs +++ b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs @@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors Initialise(source); } - public virtual void Initialise(IConfigSource source) + public void Initialise(IConfigSource source) { IConfig gridConfig = source.Configs["AgentPreferencesService"]; if (gridConfig == null) From 81ef04c9fda6cadf0de3ca3e0f93db5670ea43c7 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 16:55:51 +0000 Subject: [PATCH 16/47] fix type bug on hyperlinks --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index db33b1a486..3b85160df9 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,7 +198,7 @@ namespace OpenSim.Services.GridService mapName = mapName.Trim(); - if (!mapName.StartsWith("http") && !!mapName.StartsWith("https")) + if (!mapName.StartsWith("http") && !mapName.StartsWith("https")) { // Formats: grid.example.com:8002:region name // grid.example.com:region name From 8c19ea910a404295292a09762fc48dadd2fce2d4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 23:34:33 +0000 Subject: [PATCH 17/47] remove a wrong virtual dec ( no overides, and cant really have if used on a constructor like in assetlandmark) --- OpenSim/Framework/AssetBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 33be612402..87fd04affe 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -155,7 +155,7 @@ namespace OpenSim.Framework } } - public virtual byte[] Data + public byte[] Data { get { return m_data; } set { m_data = value; } From 7524c7729f820a510278a712e658b0865f83d079 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 01:34:07 +0000 Subject: [PATCH 18/47] change asset description max size --- OpenSim/Data/MySQL/MySQLAssetData.cs | 8 ++++++++ OpenSim/Data/MySQL/MySQLXAssetData.cs | 10 +++++----- OpenSim/Data/PGSQL/PGSQLAssetData.cs | 10 +++++----- OpenSim/Data/SQLite/SQLiteAssetData.cs | 10 +++++----- OpenSim/Framework/AssetBase.cs | 16 ++++++++++++++-- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 1488e1a5bb..83e7e4cf3e 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -170,6 +170,14 @@ namespace OpenSim.Data.MySQL } string assetDescription = asset.Description; + if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) + { + if(asset.Type == (sbyte) AssetType.Landmark) + assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); + else + assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); + } + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index ec2bcc69e9..6c6f560a4c 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -214,12 +214,12 @@ namespace OpenSim.Data.MySQL } string assetDescription = asset.Description; - if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) + if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) { - assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); - m_log.WarnFormat( - "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", - asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); + if(asset.Type == (sbyte) AssetType.Landmark) + assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); + else + assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); } if (m_enableCompression) diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs index 81adb034a9..97ea6a4ab5 100644 --- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs @@ -175,12 +175,12 @@ namespace OpenSim.Data.PGSQL } string assetDescription = asset.Description; - if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) + if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) { - assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); - m_log.WarnFormat( - "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", - asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); + if(asset.Type == (sbyte) AssetType.Landmark) + assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); + else + assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); } using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 9c2bd2e46e..9fbd9c7fab 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -143,12 +143,12 @@ namespace OpenSim.Data.SQLite } string assetDescription = asset.Description; - if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) + if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) { - assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); - m_log.WarnFormat( - "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", - asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); + if(asset.Type == (sbyte) AssetType.Landmark) + assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); + else + assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); } //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 87fd04affe..67239ec105 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -51,7 +51,8 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly int MAX_ASSET_NAME = 64; - public static readonly int MAX_ASSET_DESC = 64; + public static readonly int MAX_ASSET_DESC = 127; + public static readonly int MAX_LMASSET_DESC = 255; /// /// Data of the Asset @@ -305,7 +306,18 @@ namespace OpenSim.Framework public string Description { get { return m_description; } - set { m_description = value; } + set + { + if(value.Length > AssetBase.MAX_LMASSET_DESC) + { + if(m_type == (sbyte) AssetType.Landmark) + m_description = value.Substring(0, AssetBase.MAX_LMASSET_DESC); + else + m_description = value.Substring(0, AssetBase.MAX_ASSET_DESC); + } + else + m_description = value; + } } public DateTime CreationDate From 4e64445c39c3de1941e071ff32d06702a3440d5d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 05:18:06 +0000 Subject: [PATCH 19/47] replace datetime.now on just timming by faster utcnow --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++--- .../Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c349369604..09f0b19201 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5454,6 +5454,7 @@ Label_GroupsDone: public void CleanTempObjects() { + DateTime now = DateTime.UtcNow; EntityBase[] entities = GetEntities(); foreach (EntityBase obj in entities) { @@ -5465,7 +5466,7 @@ Label_GroupsDone: { if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) { - if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) + if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= now) DeleteSceneObject(grp, false); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e643db7436..0cd738daa3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -153,9 +153,9 @@ namespace OpenSim.Region.Framework.Scenes { m_scene.SceneGraph.FireChangeBackup(this); } - timeLastChanged = DateTime.Now.Ticks; + timeLastChanged = DateTime.UtcNow.Ticks; if (!m_hasGroupChanged) - timeFirstChanged = DateTime.Now.Ticks; + timeFirstChanged = DateTime.UtcNow.Ticks; if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) { /* @@ -233,7 +233,7 @@ namespace OpenSim.Region.Framework.Scenes m_minPersistTime = m_scene.m_dontPersistBefore; } - long currentTime = DateTime.Now.Ticks; + long currentTime = DateTime.UtcNow.Ticks; if (timeLastChanged == 0) timeLastChanged = currentTime; if (timeFirstChanged == 0) timeFirstChanged = currentTime; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9d1dca2725..3a06e7df42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -185,8 +185,7 @@ namespace OpenSim.Region.Framework.Scenes return !(SitTargetPosition == Vector3.Zero && (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion - || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 1f && SitTargetOrientation.W == 0f // W-Z Mapping was invalid at one point - || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f)); // Invalid Quaternion + || (SitTargetOrientation.W == 0f && SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f ))); // Invalid Quaternion } } @@ -1909,7 +1908,7 @@ namespace OpenSim.Region.Framework.Scenes public void ResetExpire() { - Expires = DateTime.Now + new TimeSpan(600000000); + Expires = DateTime.UtcNow + new TimeSpan(600000000); } public void AddFlag(PrimFlags flag) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index d72590792a..7129c8a241 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -880,7 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance try { m_CurrentEvent = data.EventName; - m_EventStart = DateTime.Now; + m_EventStart = DateTime.UtcNow; m_InEvent = true; try @@ -1033,7 +1033,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (!m_InEvent) return 0; - return (DateTime.Now - m_EventStart).Seconds; + return (DateTime.UtcNow - m_EventStart).Seconds; } public void ResetScript(int timeout) From 385a265971372a556a94ef5f96ea61f9065c041d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 09:35:37 +0000 Subject: [PATCH 20/47] supress some warnings by explict(confirm) the hide of parent fields --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 2 -- .../Avatar/Concierge/ConciergeModule.cs | 14 +++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index fe0a243b9f..5164289970 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -55,9 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat protected List FreezeCache = new List(); protected string m_adminPrefix = ""; protected object m_syncy = new object(); - protected IConfig m_config; - #region ISharedRegionModule Members public virtual void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index c48e58585e..c4a70c0d57 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -53,15 +53,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private const int DEBUG_CHANNEL = 2147483647; +// private const int DEBUG_CHANNEL = 2147483647; use base value - private List m_scenes = new List(); + private new List m_scenes = new List(); private List m_conciergedScenes = new List(); private bool m_replacingChatModule = false; - private IConfig m_config; - private string m_whoami = "conferencier"; private Regex m_regions = null; private string m_welcomes = null; @@ -72,14 +70,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge private string m_brokerURI = String.Empty; private int m_brokerUpdateTimeout = 300; - internal object m_syncy = new object(); + internal new object m_syncy = new object(); - internal bool m_enabled = false; + internal new bool m_enabled = false; #region ISharedRegionModule Members public override void Initialise(IConfigSource config) { - m_config = config.Configs["Concierge"]; + IConfig m_config = config.Configs["Concierge"]; if (null == m_config) return; @@ -89,7 +87,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge m_enabled = true; - // check whether ChatModule has been disabled: if yes, // then we'll "stand in" try @@ -136,7 +133,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge } } - public override void AddRegion(Scene scene) { if (!m_enabled) return; From b43717a39721adf14cb84d9d43055036b605a060 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 22 Nov 2016 11:47:50 +0000 Subject: [PATCH 21/47] Coding standards: A local variable may not use the prefix m_ --- .../Avatar/Concierge/ConciergeModule.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index c4a70c0d57..6c147f4be1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -75,14 +75,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge internal new bool m_enabled = false; #region ISharedRegionModule Members - public override void Initialise(IConfigSource config) + public override void Initialise(IConfigSource configSource) { - IConfig m_config = config.Configs["Concierge"]; + IConfig config = configSource.Configs["Concierge"]; - if (null == m_config) + if (config == null) return; - if (!m_config.GetBoolean("enabled", false)) + if (!config.GetBoolean("enabled", false)) return; m_enabled = true; @@ -91,7 +91,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge // then we'll "stand in" try { - if (config.Configs["Chat"] == null) + if (configSource.Configs["Chat"] == null) { // if Chat module has not been configured it's // enabled by default, so we are not going to @@ -100,7 +100,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge } else { - m_replacingChatModule = !config.Configs["Chat"].GetBoolean("enabled", true); + m_replacingChatModule = !configSource.Configs["Chat"].GetBoolean("enabled", true); } } catch (Exception) @@ -111,21 +111,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge m_log.InfoFormat("[Concierge] {0} ChatModule", m_replacingChatModule ? "replacing" : "not replacing"); // take note of concierge channel and of identity - m_conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel); - m_whoami = m_config.GetString("whoami", "conferencier"); - m_welcomes = m_config.GetString("welcomes", m_welcomes); - m_announceEntering = m_config.GetString("announce_entering", m_announceEntering); - m_announceLeaving = m_config.GetString("announce_leaving", m_announceLeaving); - m_xmlRpcPassword = m_config.GetString("password", m_xmlRpcPassword); - m_brokerURI = m_config.GetString("broker", m_brokerURI); - m_brokerUpdateTimeout = m_config.GetInt("broker_timeout", m_brokerUpdateTimeout); + m_conciergeChannel = configSource.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel); + m_whoami = config.GetString("whoami", "conferencier"); + m_welcomes = config.GetString("welcomes", m_welcomes); + m_announceEntering = config.GetString("announce_entering", m_announceEntering); + m_announceLeaving = config.GetString("announce_leaving", m_announceLeaving); + m_xmlRpcPassword = config.GetString("password", m_xmlRpcPassword); + m_brokerURI = config.GetString("broker", m_brokerURI); + m_brokerUpdateTimeout = config.GetInt("broker_timeout", m_brokerUpdateTimeout); m_log.InfoFormat("[Concierge] reporting as \"{0}\" to our users", m_whoami); // calculate regions Regex if (m_regions == null) { - string regions = m_config.GetString("regions", String.Empty); + string regions = config.GetString("regions", String.Empty); if (!String.IsNullOrEmpty(regions)) { m_regions = new Regex(@regions, RegexOptions.Compiled | RegexOptions.IgnoreCase); From 94e48838d5b1f0bf0c5b0e40b7bc9a6f1be156e9 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 22 Nov 2016 15:31:45 +0000 Subject: [PATCH 22/47] Include new Region.ini option for DefaultLandingPoint for teleports with no coords specified. This is useful when using a Telehub would be to restrictive as it would block landmarks and map teleports. This location is only ever used when no coordinates are provided. If config value not set, the previous default of 128,128 is used. --- OpenSim/Framework/RegionInfo.cs | 58 +++++++++++++++++++ .../EntityTransfer/EntityTransferModule.cs | 4 ++ .../Region/Framework/Scenes/ScenePresence.cs | 4 ++ bin/Regions/Regions.ini.example | 3 + 4 files changed, 69 insertions(+) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ac7735248a..b6e9d9f1f4 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -176,6 +176,9 @@ namespace OpenSim.Framework /// public uint RegionSizeZ = Constants.RegionHeight; + // If entering avatar has no specific coords, this is where they land + public Vector3 DefaultLandingPoint = new Vector3(128, 128, 30); + private Dictionary m_extraSettings = new Dictionary(); // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. @@ -712,6 +715,19 @@ namespace OpenSim.Framework m_regionType = config.GetString("RegionType", String.Empty); allKeys.Remove("RegionType"); + // Get Default Landing Location (Defaults to 128,128) + string temp_location = config.GetString("DefaultLanding", "<128, 128, 30>"); + Vector3 temp_vector; + + if (Vector3.TryParse(temp_location, out temp_vector)) + DefaultLandingPoint = temp_vector; + else + m_log.ErrorFormat("[RegionInfo]: Unable to parse DefaultLanding for '{0}'. The value given was '{1}'", RegionName, temp_location); + + allKeys.Remove("DefaultLanding"); + + DoDefaultLandingSanityChecks(); + #region Prim and map stuff m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); @@ -764,6 +780,48 @@ namespace OpenSim.Framework } } + // Make sure DefaultLanding is within region borders with a buffer zone 5 meters from borders + private void DoDefaultLandingSanityChecks() + { + // Sanity Check Default Landing + float buffer_zone = 5f; + + bool ValuesCapped = false; + + // Minimum Positions + if (DefaultLandingPoint.X < 0f) + { + DefaultLandingPoint.X = buffer_zone; + ValuesCapped = true; + } + + if (DefaultLandingPoint.Y < 0f) + { + DefaultLandingPoint.Y = buffer_zone; + ValuesCapped = true; + } + + // Maximum Positions + if (DefaultLandingPoint.X > RegionSizeX - buffer_zone) + { + DefaultLandingPoint.X = RegionSizeX - buffer_zone; + ValuesCapped = true; + } + + if (DefaultLandingPoint.Y > RegionSizeY - buffer_zone) + { + DefaultLandingPoint.Y = RegionSizeY - buffer_zone; + ValuesCapped = true; + } + + // Height + if (DefaultLandingPoint.Z < 0f) + DefaultLandingPoint.Z = 0f; + + if (ValuesCapped == true) + m_log.WarnFormat("[RegionInfo]: The default landing location for {0} has been capped to {1}", RegionName, DefaultLandingPoint); + } + // Make sure user specified region sizes are sane. // Must be multiples of legacy region size (256). private void DoRegionSizeSanityChecks() diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1161571016..23cfde5c43 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -455,6 +455,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer position = emergencyPos; } + // Check Default Location (Also See ScenePresence.CompleteMovement) + if (position.X == 128f && position.Y == 128f) + position = sp.Scene.RegionInfo.DefaultLandingPoint; + // TODO: Get proper AVG Height float localHalfAVHeight = 0.8f; if (sp.Appearance != null) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7efd9200ed..2cf0e9d3ac 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2043,6 +2043,10 @@ namespace OpenSim.Region.Framework.Scenes look = new Vector3(0.99f, 0.042f, 0); } + // Check Default Location (Also See EntityTransferModule.TeleportAgentWithinRegion) + if (AbsolutePosition.X == 128f && AbsolutePosition.Y == 128f) + AbsolutePosition = Scene.RegionInfo.DefaultLandingPoint; + if (!MakeRootAgent(AbsolutePosition, flying, ref look)) { m_log.DebugFormat( diff --git a/bin/Regions/Regions.ini.example b/bin/Regions/Regions.ini.example index e20fee609b..97d1c4f628 100644 --- a/bin/Regions/Regions.ini.example +++ b/bin/Regions/Regions.ini.example @@ -31,6 +31,9 @@ ExternalHostName = SYSTEMIP ; SizeX = 512 ; SizeY = 512 +; * Default region landing point used when no teleport coords are specified +; DefaultLanding = <128,128,30> + ; * ; * Prim data ; * This allows limiting the sizes of prims and the region prim count From 34d9596f9ba091c98130333e572d0cba8dd4ffeb Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 22 Nov 2016 15:33:34 +0000 Subject: [PATCH 23/47] Fix typo in a comment --- .../Framework/EntityTransfer/EntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 23cfde5c43..33aa7adfc9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer GridRegion reg; - // handle legacy HG. liked regions are mapped into y = 0 and have no size information + // handle legacy HG. linked regions are mapped into y = 0 and have no size information // so we can only search by base handle if( y == 0) { From 1a6cddf80761deb65773ad344e822ef74a824418 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 22 Nov 2016 21:23:01 +0000 Subject: [PATCH 24/47] Minor fix to region default landing point sanity check --- OpenSim/Framework/RegionInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index b6e9d9f1f4..ca17793e64 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -789,13 +789,13 @@ namespace OpenSim.Framework bool ValuesCapped = false; // Minimum Positions - if (DefaultLandingPoint.X < 0f) + if (DefaultLandingPoint.X < buffer_zone) { DefaultLandingPoint.X = buffer_zone; ValuesCapped = true; } - if (DefaultLandingPoint.Y < 0f) + if (DefaultLandingPoint.Y < buffer_zone) { DefaultLandingPoint.Y = buffer_zone; ValuesCapped = true; From f4745e5a354871c5b248d10bb57f40cae5cc788c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 22:24:54 +0000 Subject: [PATCH 25/47] full change ServiceThrottleModule. Let it still service RegionHandleRequest and UUIDNameRequest but this wrong since they are diferent services. Keeping gambling about not having 2 much overlaps of the 2 kind of requests. Remove double thottling of RegionHandleRequest --- .../ClientStack/Linden/UDP/LLClientView.cs | 52 +------ .../ServiceThrottle/ServiceThrottleModule.cs | 140 ++---------------- .../UserManagement/UserManagementModule.cs | 7 +- 3 files changed, 24 insertions(+), 175 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 65a341e274..f472dba9c6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9614,61 +9614,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Parcel related packets - // acumulate several HandleRegionHandleRequest consecutive overlaping requests - // to be done with minimal resources as possible - // variables temporary here while in test - - Queue RegionHandleRequests = new Queue(); - bool RegionHandleRequestsInService = false; - private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) { - UUID currentUUID; - RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; - if (handlerRegionHandleRequest == null) - return true; - - RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; - - lock (RegionHandleRequests) + if (handlerRegionHandleRequest != null) { - if (RegionHandleRequestsInService) - { - // we are already busy doing a previus request - // so enqueue it - RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); - return true; - } - - // else do it - currentUUID = rhrPack.RequestBlock.RegionID; - RegionHandleRequestsInService = true; + RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; + handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); } - while (true) - { - handlerRegionHandleRequest(this, currentUUID); - - lock (RegionHandleRequests) - { - // exit condition, nothing to do or closed - // current code seems to assume we may loose the handler at anytime, - // so keep checking it - handlerRegionHandleRequest = OnRegionHandleRequest; - - if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) - { - RegionHandleRequests.Clear(); - RegionHandleRequestsInService = false; - return true; - } - currentUUID = RegionHandleRequests.Dequeue(); - } - } - - return true; // actually unreached + return true; } private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) diff --git a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs index 3abacbd3cf..36fb57a18d 100644 --- a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs @@ -48,31 +48,16 @@ namespace OpenSim.Region.CoreModules.Framework MethodBase.GetCurrentMethod().DeclaringType); private readonly List m_scenes = new List(); - private System.Timers.Timer m_timer = new System.Timers.Timer(); - - private Queue m_RequestQueue = new Queue(); - private Dictionary> m_Pending = new Dictionary>(); - private int m_Interval; - + private JobEngine m_processorJobEngine; + #region ISharedRegionModule public void Initialise(IConfigSource config) { - m_Interval = Util.GetConfigVarFromSections(config, "Interval", new string[] { "ServiceThrottle" }, 5000); - - m_timer = new System.Timers.Timer(); - m_timer.AutoReset = false; - m_timer.Enabled = true; - m_timer.Interval = 15000; // 15 secs at first - m_timer.Elapsed += ProcessQueue; - m_timer.Start(); - - //WorkManager.StartThread( - // ProcessQueue, - // "GridServiceRequestThread", - // ThreadPriority.BelowNormal, - // true, - // false); + m_processorJobEngine = new JobEngine( + "ServiceThrottle","ServiceThrottle"); + m_processorJobEngine.RequestProcessTimeoutOnStop = 31000; // many webrequests have 30s expire + m_processorJobEngine.Start(); } public void AddRegion(Scene scene) @@ -82,7 +67,6 @@ namespace OpenSim.Region.CoreModules.Framework m_scenes.Add(scene); scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; } } @@ -105,6 +89,7 @@ namespace OpenSim.Region.CoreModules.Framework public void Close() { + m_processorJobEngine.Stop(); } public string Name @@ -126,38 +111,24 @@ namespace OpenSim.Region.CoreModules.Framework client.OnRegionHandleRequest += OnRegionHandleRequest; } - void OnMakeRootAgent(ScenePresence obj) - { - lock (m_timer) - { - if (!m_timer.Enabled) - { - m_timer.Interval = m_Interval; - m_timer.Enabled = true; - m_timer.Start(); - } - } - } - public void OnRegionHandleRequest(IClientAPI client, UUID regionID) { //m_log.DebugFormat("[SERVICE THROTTLE]: RegionHandleRequest {0}", regionID); - ulong handle = 0; - if (IsLocalRegionHandle(regionID, out handle)) - { - client.SendRegionHandle(regionID, handle); - return; - } - Action action = delegate { + if(!client.IsActive) + return; + GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, regionID); + if(!client.IsActive) + return; + if (r != null && r.RegionHandle != 0) client.SendRegionHandle(regionID, r.RegionHandle); }; - Enqueue("region", regionID.ToString(), action); + m_processorJobEngine.QueueJob("regionHandle", action, regionID.ToString()); } #endregion Events @@ -166,91 +137,10 @@ namespace OpenSim.Region.CoreModules.Framework public void Enqueue(string category, string itemid, Action continuation) { - lock (m_RequestQueue) - { - if (m_Pending.ContainsKey(category)) - { - if (m_Pending[category].Contains(itemid)) - // Don't enqueue, it's already pending - return; - } - else - m_Pending.Add(category, new List()); - - m_Pending[category].Add(itemid); - - m_RequestQueue.Enqueue(delegate - { - lock (m_RequestQueue) - m_Pending[category].Remove(itemid); - - continuation(); - }); - } + m_processorJobEngine.QueueJob(category, continuation, itemid); } #endregion IServiceThrottleModule - - #region Process Continuation Queue - - private void ProcessQueue(object sender, System.Timers.ElapsedEventArgs e) - { - //m_log.DebugFormat("[YYY]: Process queue with {0} continuations", m_RequestQueue.Count); - - while (m_RequestQueue.Count > 0) - { - Action continuation = null; - lock (m_RequestQueue) - continuation = m_RequestQueue.Dequeue(); - - if (continuation != null) - continuation(); - } - - if (AreThereRootAgents()) - { - lock (m_timer) - { - m_timer.Interval = 1000; // 1 sec - m_timer.Enabled = true; - m_timer.Start(); - } - } - else - lock (m_timer) - m_timer.Enabled = false; - - } - - #endregion Process Continuation Queue - - #region Misc - - private bool IsLocalRegionHandle(UUID regionID, out ulong regionHandle) - { - regionHandle = 0; - foreach (Scene s in m_scenes) - if (s.RegionInfo.RegionID == regionID) - { - regionHandle = s.RegionInfo.RegionHandle; - return true; - } - return false; - } - - private bool AreThereRootAgents() - { - foreach (Scene s in m_scenes) - { - foreach (ScenePresence sp in s.GetScenePresences()) - if (!sp.IsChildAgent) - return true; - } - - return false; - } - - #endregion Misc } } diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 72fff2290f..5507526310 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } // Not found in cache, queue continuation - m_ServiceThrottle.Enqueue("name", uuid.ToString(), delegate + m_ServiceThrottle.Enqueue("uuidname", uuid.ToString(), delegate { //m_log.DebugFormat("[YYY]: Name request {0}", uuid); @@ -216,9 +216,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement // So to avoid clients // (particularly Hypergrid clients) permanently binding "Unknown User" to a given UUID, we will // instead drop the request entirely. + if(!client.IsActive) + return; if (GetUser(uuid, out user)) { - client.SendNameReply(uuid, user.FirstName, user.LastName); + if(client.IsActive) + client.SendNameReply(uuid, user.FirstName, user.LastName); } // else // m_log.DebugFormat( From 59f6353ac1270f8b8967ad515e2f06331f44c295 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 22:29:13 +0000 Subject: [PATCH 26/47] close a resource on jobengine.close() --- OpenSim/Framework/Monitoring/JobEngine.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs index 7709f629aa..df6b806b4c 100644 --- a/OpenSim/Framework/Monitoring/JobEngine.cs +++ b/OpenSim/Framework/Monitoring/JobEngine.cs @@ -136,7 +136,8 @@ namespace OpenSim.Framework.Monitoring if(m_jobQueue.Count <= 0) m_cancelSource.Cancel(); - m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop); + if(m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop)) + m_finishedProcessingAfterStop.Close(); } finally { From 82ed6bde6e7258ee8380a2e8466d4a7e32c9e5e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 10:00:56 +0000 Subject: [PATCH 27/47] fix maturity on parcelInfo --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f472dba9c6..498d5fe7c0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3126,10 +3126,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ActualArea = land.Area; reply.Data.BillableArea = land.Area; // TODO: what is this? - // Bit 0: Mature, bit 7: on sale, other bits: no idea - reply.Data.Flags = (byte)( - (info.AccessLevel > 13 ? (1 << 0) : 0) + - ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0)); + reply.Data.Flags = (byte)Util.ConvertAccessLevelToMaturity((byte)info.AccessLevel); + if((land.Flags & (uint)ParcelFlags.ForSale) != 0) + reply.Data.Flags |= (byte)((1 << 7)); Vector3 pos = land.UserLocation; if (pos.Equals(Vector3.Zero)) From b3eda582ec44ee375a116b91887ddb1bf7c22917 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 19:30:55 +0000 Subject: [PATCH 28/47] add to SynchronousRestFormsRequester a keepalive disable option, and make use of it on some friends conns --- OpenSim/Framework/WebUtil.cs | 15 ++++----------- .../Connectors/Friends/FriendsSimConnector.cs | 2 +- .../Hypergrid/HGFriendsServicesConnector.cs | 5 ++++- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 2bbf785661..f927e6963b 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -1019,7 +1019,8 @@ namespace OpenSim.Framework /// /// Thrown if we encounter a network issue while posting /// the request. You'll want to make sure you deal with this as they're not uncommon - public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs, IServiceAuth auth) + public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs = -1, + IServiceAuth auth = null, bool keepalive = true) { int reqnum = WebUtil.RequestNumber++; @@ -1034,6 +1035,8 @@ namespace OpenSim.Framework request.Method = verb; if (timeoutsecs > 0) request.Timeout = timeoutsecs * 1000; + if(!keepalive && request is HttpWebRequest) + ((HttpWebRequest)request).KeepAlive = false; if (auth != null) auth.AddAuthorization(request.Headers); @@ -1125,16 +1128,6 @@ namespace OpenSim.Framework return respstring; } - public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) - { - return MakeRequest(verb, requestUrl, obj, timeoutsecs, null); - } - - public static string MakeRequest(string verb, string requestUrl, string obj) - { - return MakeRequest(verb, requestUrl, obj, -1); - } - public static string MakeRequest(string verb, string requestUrl, string obj, IServiceAuth auth) { return MakeRequest(verb, requestUrl, obj, -1, auth); diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index 45f4514814..74cd703a35 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs @@ -158,7 +158,7 @@ namespace OpenSim.Services.Connectors.Friends try { - string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); + string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, 15, null, false); if (reply != string.Empty) { Dictionary replyData = ServerUtils.ParseXmlResponse(reply); diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs index 622d4e1712..8b31fa2d9d 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs @@ -277,7 +277,10 @@ namespace OpenSim.Services.Connectors.Hypergrid { reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, - ServerUtils.BuildQueryString(sendData), 15); + ServerUtils.BuildQueryString(sendData), + 15, + null, + false); } catch (Exception e) { From 72e20028d1a5c7bedfcde56429d211d8e427c7a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 20:26:14 +0000 Subject: [PATCH 29/47] safeguard against unknown material replacemet --- OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 006b730074..7312bc39a8 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -532,7 +532,7 @@ namespace OpenSim.Region.OptionalModules.Materials lock(m_Materials) { - if(oldid != UUID.Zero) + if(oldid != UUID.Zero && m_MaterialsRefCount.ContainsKey(oldid)) { m_MaterialsRefCount[oldid]--; if(m_MaterialsRefCount[oldid] <= 0) From d9789596d4db77b086d05f6dd7503a380e468284 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 20:41:10 +0000 Subject: [PATCH 30/47] take parcel_owner_is_god option from ini.example since it is not a recomended option for general use --- bin/OpenSimDefaults.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 35530027ea..3f8864e92f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -473,7 +473,7 @@ ;region_manager_is_god = false ; Allow parcel owners to assume god powers in their parcels - ; you really may not want this... + ; you really do not want this... ;parcel_owner_is_god = false ; Control user types that are allowed to create new scripts From 75ad210b6bda5c1703c8be191927f9c2baf928c3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 20:44:55 +0000 Subject: [PATCH 31/47] it is nice to save a file to atually change it... --- bin/OpenSim.ini.example | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 5103e7184d..bb73687cda 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -391,10 +391,6 @@ ;; Allow region managers to assume god powers in regions they manage ; region_manager_is_god = false - ;# {parcel_owner_is_god} {} {Allow parcel owner gods} {true false} false - ;; Allow parcel owners to assume god powers in their parcels - ; parcel_owner_is_god = false - ;# {simple_build_permissions} {} {Allow building in parcel by access list (no groups)} {true false} false ;; More control over permissions ;; This is definitely not SL! From 94ec5884b7d3cfe350725d5734d227fa1becee94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 22:15:59 +0000 Subject: [PATCH 32/47] fix llRez(AtRoot/Object) error messages on shared code path --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index af0495119f..3db5dd2820 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3482,13 +3482,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - Error("llRezAtRoot", "Can't find object '" + inventory + "'"); + Error("llRez(AtRoot/Object)", "Can't find object '" + inventory + "'"); return; } if (item.InvType != (int)InventoryType.Object) { - Error("llRezAtRoot", "Can't create requested object; object is missing from database"); + Error("llRez(AtRoot/Object)", "Can't create requested object; object is missing from database"); return; } @@ -3532,7 +3532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) } - }, null, "LSL_Api.llRezAtRoot"); + }, null, "LSL_Api.doObjectRez"); //ScriptSleep((int)((groupmass * velmag) / 10)); ScriptSleep(m_sleepMsOnRezAtRoot); From 5202ae7bb4b3e20aad762811195922da6926a54c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Nov 2016 14:39:08 +0000 Subject: [PATCH 33/47] revert changes to asset desc size, my bad.. this field will possible go away in future --- OpenSim/Data/MySQL/MySQLAssetData.cs | 8 -------- OpenSim/Data/MySQL/MySQLXAssetData.cs | 10 +++++----- OpenSim/Data/PGSQL/PGSQLAssetData.cs | 10 +++++----- OpenSim/Data/SQLite/SQLiteAssetData.cs | 10 +++++----- OpenSim/Framework/AssetBase.cs | 16 ++-------------- 5 files changed, 17 insertions(+), 37 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 83e7e4cf3e..1488e1a5bb 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -170,14 +170,6 @@ namespace OpenSim.Data.MySQL } string assetDescription = asset.Description; - if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) - { - if(asset.Type == (sbyte) AssetType.Landmark) - assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); - else - assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); - } - if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 6c6f560a4c..ec2bcc69e9 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -214,12 +214,12 @@ namespace OpenSim.Data.MySQL } string assetDescription = asset.Description; - if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - if(asset.Type == (sbyte) AssetType.Landmark) - assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); - else - assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); + m_log.WarnFormat( + "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", + asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); } if (m_enableCompression) diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs index 97ea6a4ab5..81adb034a9 100644 --- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs @@ -175,12 +175,12 @@ namespace OpenSim.Data.PGSQL } string assetDescription = asset.Description; - if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - if(asset.Type == (sbyte) AssetType.Landmark) - assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); - else - assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); + m_log.WarnFormat( + "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", + asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); } using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 9fbd9c7fab..9c2bd2e46e 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -143,12 +143,12 @@ namespace OpenSim.Data.SQLite } string assetDescription = asset.Description; - if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - if(asset.Type == (sbyte) AssetType.Landmark) - assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); - else - assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); + m_log.WarnFormat( + "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", + asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); } //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 67239ec105..87fd04affe 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -51,8 +51,7 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly int MAX_ASSET_NAME = 64; - public static readonly int MAX_ASSET_DESC = 127; - public static readonly int MAX_LMASSET_DESC = 255; + public static readonly int MAX_ASSET_DESC = 64; /// /// Data of the Asset @@ -306,18 +305,7 @@ namespace OpenSim.Framework public string Description { get { return m_description; } - set - { - if(value.Length > AssetBase.MAX_LMASSET_DESC) - { - if(m_type == (sbyte) AssetType.Landmark) - m_description = value.Substring(0, AssetBase.MAX_LMASSET_DESC); - else - m_description = value.Substring(0, AssetBase.MAX_ASSET_DESC); - } - else - m_description = value; - } + set { m_description = value; } } public DateTime CreationDate From f9b62b5680be1935857e9517b1a6bcd770c7b683 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Nov 2016 20:53:04 +0000 Subject: [PATCH 34/47] work around viewers not suporting large regions on landmark creation. They still may display wrong offset; don't let inventory description be limited by asset description side on a ossl method --- .../World/Land/LandManagementModule.cs | 53 +++++++++++++------ .../Shared/Api/Implementation/OSSL_Api.cs | 4 +- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 11a6d9f745..98f1f3bd44 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1801,30 +1801,51 @@ namespace OpenSim.Region.CoreModules.World.Land { Hashtable hash = new Hashtable(); hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); - if (hash.ContainsKey("region_id") && hash.ContainsKey("location")) + if (hash.ContainsKey("location")) { - UUID regionID = (UUID)hash["region_id"]; + UUID scope = m_scene.RegionInfo.ScopeID; ArrayList list = (ArrayList)hash["location"]; uint x = (uint)(double)list[0]; uint y = (uint)(double)list[1]; - if (hash.ContainsKey("region_handle")) + if(hash.ContainsKey("region_id")) + { + UUID regionID = (UUID)hash["region_id"]; + if (regionID == m_scene.RegionInfo.RegionID) + { + // a parcel request for a local parcel => no need to query the grid + parcelID = Util.BuildFakeParcelID(m_scene.RegionInfo.RegionHandle, x, y); + } + else + { + // a parcel request for a parcel in another region. Ask the grid about the region + GridRegion info = m_scene.GridService.GetRegionByUUID(scope, regionID); + if (info != null) + parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); + } + } + + else if (hash.ContainsKey("region_handle")) { // if you do a "About Landmark" on a landmark a second time, the viewer sends the // region_handle it got earlier via RegionHandleRequest ulong regionHandle = Util.BytesToUInt64Big((byte[])hash["region_handle"]); - parcelID = Util.BuildFakeParcelID(regionHandle, x, y); - } - else if (regionID == m_scene.RegionInfo.RegionID) - { - // a parcel request for a local parcel => no need to query the grid - parcelID = Util.BuildFakeParcelID(m_scene.RegionInfo.RegionHandle, x, y); - } - else - { - // a parcel request for a parcel in another region. Ask the grid about the region - GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID); - if (info != null) - parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); + if(regionHandle == m_scene.RegionInfo.RegionHandle) + parcelID = Util.BuildFakeParcelID(regionHandle, x, y); + else + { + uint wx; + uint wy; + Util.RegionHandleToWorldLoc(regionHandle, out wx, out wy); + wx += x; + wy += y; + GridRegion info = m_scene.GridService.GetRegionByPosition(scope, (int)wx, (int)wy); + if(info != null) + { + wx -= (uint)info.RegionLocX; + wy -= (uint)info.RegionLocY; + parcelID = Util.BuildFakeParcelID(info.RegionHandle, wx, wy); + } + } } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 57bff6e689..1a594e1c35 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1938,8 +1938,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.ResetIDs(m_host.UUID); taskItem.ParentID = m_host.UUID; taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); - taskItem.Name = asset.Name; - taskItem.Description = asset.Description; + taskItem.Name = name; + taskItem.Description = description; taskItem.Type = (int)AssetType.Notecard; taskItem.InvType = (int)InventoryType.Notecard; taskItem.OwnerID = m_host.OwnerID; From e45245d267a91a5f79f0e54351d4e24b8c1690c0 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Thu, 24 Nov 2016 23:40:20 +0100 Subject: [PATCH 35/47] Implementation of LSL_Integer llScaleByFactor(double scaling_factor) Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/LSL_Api.cs | 46 +++++++++++++++++++ .../Shared/Api/Interface/ILSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Stub.cs | 5 ++ 3 files changed, 52 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3db5dd2820..b5abdb597d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1803,6 +1803,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; } + public LSL_Integer llScaleByFactor(double scaling_factor) + { + m_host.AddScriptLPS(1); + SceneObjectGroup group = m_host.ParentGroup; + + if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) + return ScriptBaseClass.FALSE; + + if (group.RootPart.KeyframeMotion != null) + return ScriptBaseClass.FALSE; + + List prims = GetLinkParts(ScriptBaseClass.LINK_SET); + if (prims.Count > 0) + { + foreach (SceneObjectPart prim in prims) + { + LSL_Vector size = new LSL_Vector(prim.Scale.X, prim.Scale.Y, prim.Scale.Z); + LSL_Vector new_size = new LSL_Vector(scaling_factor * size); + + new_size.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.x)); + new_size.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.y)); + new_size.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.z)); + + if (new_size.x != scaling_factor * size.x || new_size.y != scaling_factor * size.y || new_size.z != scaling_factor * size.z) + return ScriptBaseClass.FALSE; + + LSL_Vector position = new LSL_Vector(GetPartLocalPos(prim)); + + if (!prim.IsRoot) + { + position = GetSetPosTarget(prim, scaling_factor * position, position, true); + prim.OffsetPosition = position; + prim.ScheduleTerseUpdate(); + } + + SetScale(prim, new_size); + } + + return ScriptBaseClass.TRUE; + } + else + { + return ScriptBaseClass.FALSE; + } + } + public void llSetScale(LSL_Vector scale) { m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 3d1482d921..ea0b6f9dc4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -326,6 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llRound(double f); LSL_Integer llSameGroup(string agent); void llSay(int channelID, string text); + LSL_Integer llScaleByFactor(double scaling_factor); void llScaleTexture(double u, double v, int face); LSL_Integer llScriptDanger(LSL_Vector pos); void llScriptProfiler(LSL_Integer flag); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 2769712f2a..6aaf93011d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1465,6 +1465,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSay(channelID, text); } + public LSL_Integer llScaleByFactor(double scaling_factor) + { + return m_LSL_Functions.llScaleByFactor(scaling_factor); + } + public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); From b82a41d2606dfaf42455e0030b5640752167162b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Nov 2016 17:34:19 +0000 Subject: [PATCH 36/47] change llScaleByFactor (sorry Mandarinka). --- .../Framework/Scenes/SceneObjectGroup.cs | 97 +++++++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 39 ++------ 2 files changed, 106 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0cd738daa3..739d23d350 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -4161,6 +4161,103 @@ namespace OpenSim.Region.Framework.Scenes } + public bool GroupResize(double fscale) + { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, fscale); + + if (Scene == null || IsDeleted || inTransit || fscale < 0) + return false; + + // ignore lsl restrictions. let them be done a LSL + PhysicsActor pa = m_rootPart.PhysActor; + + if(RootPart.KeyframeMotion != null) + RootPart.KeyframeMotion.Suspend(); + + float minsize = Scene.m_minNonphys; + float maxsize = Scene.m_maxNonphys; + + // assuming physics is more restrictive + if (pa != null && pa.IsPhysical) + { + minsize = Scene.m_minPhys; + maxsize = Scene.m_maxPhys; + } + + SceneObjectPart[] parts = m_parts.GetArray(); + float tmp; + // check scaling factor so parts don't violate dimensions + for(int i = 0; i < parts.Length; i++) + { + SceneObjectPart obPart = parts[i]; + Vector3 oldSize = new Vector3(obPart.Scale); + tmp = (float)(oldSize.X * fscale); + if(tmp > maxsize) + return false; + if(tmp < minsize) + return false; + + tmp = (float)(oldSize.Y * fscale); + if(tmp > maxsize) + return false; + if(tmp < minsize) + return false; + + tmp = (float)(oldSize.Z * fscale); + if(tmp > maxsize) + return false; + if(tmp < minsize) + return false; + } + + Vector3 newSize = RootPart.Scale; + newSize.X = (float)(newSize.X * fscale); + newSize.Y = (float)(newSize.Y * fscale); + newSize.Z = (float)(newSize.Z * fscale); + + if(pa != null) + pa.Building = true; + + RootPart.Scale = newSize; + + Vector3 currentpos; + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart obPart = parts[i]; + + if (obPart.UUID != m_rootPart.UUID) + { + currentpos = obPart.OffsetPosition; + currentpos.X = (float)(currentpos.X * fscale); + currentpos.Y = (float)(currentpos.Y * fscale); + currentpos.Z = (float)(currentpos.Z * fscale); + + newSize = obPart.Scale; + newSize.X = (float)(newSize.X * fscale); + newSize.Y = (float)(newSize.Y * fscale); + newSize.Z = (float)(newSize.Z * fscale); + + obPart.Scale = newSize; + obPart.UpdateOffSet(currentpos); + } + } + + if(pa != null) + pa.Building = false; + + InvalidBoundsRadius(); + + HasGroupChanged = true; + m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); + ScheduleGroupForFullUpdate(); + + if(RootPart.KeyframeMotion != null) + RootPart.KeyframeMotion.Resume(); + + return true; + } + #endregion #region Position diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b5abdb597d..c43aef58f4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1808,45 +1808,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); SceneObjectGroup group = m_host.ParentGroup; + if(scaling_factor < 1e-6) + return ScriptBaseClass.FALSE; + if(scaling_factor > 1e6) + return ScriptBaseClass.FALSE; + + if (group == null || group.IsDeleted || group.inTransit) + return ScriptBaseClass.FALSE; + if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) return ScriptBaseClass.FALSE; if (group.RootPart.KeyframeMotion != null) return ScriptBaseClass.FALSE; - List prims = GetLinkParts(ScriptBaseClass.LINK_SET); - if (prims.Count > 0) - { - foreach (SceneObjectPart prim in prims) - { - LSL_Vector size = new LSL_Vector(prim.Scale.X, prim.Scale.Y, prim.Scale.Z); - LSL_Vector new_size = new LSL_Vector(scaling_factor * size); - - new_size.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.x)); - new_size.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.y)); - new_size.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, new_size.z)); - - if (new_size.x != scaling_factor * size.x || new_size.y != scaling_factor * size.y || new_size.z != scaling_factor * size.z) - return ScriptBaseClass.FALSE; - - LSL_Vector position = new LSL_Vector(GetPartLocalPos(prim)); - - if (!prim.IsRoot) - { - position = GetSetPosTarget(prim, scaling_factor * position, position, true); - prim.OffsetPosition = position; - prim.ScheduleTerseUpdate(); - } - - SetScale(prim, new_size); - } - + if(group.GroupResize(scaling_factor)) return ScriptBaseClass.TRUE; - } else - { return ScriptBaseClass.FALSE; - } } public void llSetScale(LSL_Vector scale) From 935510d87956f080f1425982b3da918009c32feb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Nov 2016 18:35:23 +0000 Subject: [PATCH 37/47] add llGetMaxScaleFactor and llGetMinScaleFactor --- .../Framework/Scenes/SceneObjectGroup.cs | 77 +++++++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 22 ++++++ .../Shared/Api/Interface/ILSL_Api.cs | 2 + .../Shared/Api/Runtime/LSL_Stub.cs | 10 +++ 4 files changed, 111 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 739d23d350..6cdbac5e6d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -4258,6 +4258,83 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public float GetMaxGroupResizeScale() + { + if (Scene == null || IsDeleted || inTransit) + return 1.0f; + + float maxsize = Scene.m_maxNonphys; + PhysicsActor pa = m_rootPart.PhysActor; + // assuming physics is more restrictive + if (pa != null && pa.IsPhysical) + maxsize = Scene.m_maxPhys; + + SceneObjectPart[] parts = m_parts.GetArray(); + float larger = float.MinValue; + + for(int i = 0; i < parts.Length; i++) + { + SceneObjectPart obPart = parts[i]; + Vector3 oldSize = new Vector3(obPart.Scale); + if(larger < oldSize.X) + larger = oldSize.X; + + if(larger < oldSize.Y) + larger = oldSize.Y; + + if(larger < oldSize.Z) + larger = oldSize.Z; + } + + if(larger >= maxsize) + return 1.0f; + + larger += 1e-3f; + float fscale = maxsize / larger; + + return fscale; + } + + public float GetMinGroupResizeScale() + { + if (Scene == null || IsDeleted || inTransit) + return 1.0f; + + float minsize = Scene.m_minNonphys; + PhysicsActor pa = m_rootPart.PhysActor; + // assuming physics is more restrictive + if (pa != null && pa.IsPhysical) + minsize = Scene.m_minPhys; + + SceneObjectPart[] parts = m_parts.GetArray(); + float smaller = float.MaxValue; + + for(int i = 0; i < parts.Length; i++) + { + SceneObjectPart obPart = parts[i]; + Vector3 oldSize = new Vector3(obPart.Scale); + if(smaller > oldSize.X) + smaller = oldSize.X; + + if(smaller > oldSize.Y) + smaller = oldSize.Y; + + if(smaller > oldSize.Z) + smaller = oldSize.Z; + } + + if(smaller <= minsize) + return 1.0f; + + if(smaller > 2e-3f) + smaller -= 1e-3f; + float fscale = minsize / smaller; + if(fscale < 1e-8f) + fscale = 1e-8f; + + return fscale; + } + #endregion #region Position diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c43aef58f4..a9c57898d7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1828,6 +1828,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.FALSE; } + public LSL_Float llGetMaxScaleFactor() + { + m_host.AddScriptLPS(1); + SceneObjectGroup group = m_host.ParentGroup; + + if (group == null || group.IsDeleted || group.inTransit) + return 1.0f; + + return (LSL_Float)group.GetMaxGroupResizeScale(); + } + + public LSL_Float llGetMinScaleFactor() + { + m_host.AddScriptLPS(1); + SceneObjectGroup group = m_host.ParentGroup; + + if (group == null || group.IsDeleted || group.inTransit) + return 1.0f; + + return (LSL_Float)group.GetMinGroupResizeScale(); + } + public void llSetScale(LSL_Vector scale) { m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index ea0b6f9dc4..cc5240375c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -327,6 +327,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llSameGroup(string agent); void llSay(int channelID, string text); LSL_Integer llScaleByFactor(double scaling_factor); + LSL_Float llGetMaxScaleFactor(); + LSL_Float llGetMinScaleFactor(); void llScaleTexture(double u, double v, int face); LSL_Integer llScriptDanger(LSL_Vector pos); void llScriptProfiler(LSL_Integer flag); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 6aaf93011d..9d36341947 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1470,6 +1470,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llScaleByFactor(scaling_factor); } + public LSL_Float llGetMaxScaleFactor() + { + return m_LSL_Functions.llGetMaxScaleFactor(); + } + + public LSL_Float llGetMinScaleFactor() + { + return m_LSL_Functions.llGetMinScaleFactor(); + } + public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); From 6f1080368d23d8e3952b5ffd3c3cc05f540d6402 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Nov 2016 21:37:33 +0000 Subject: [PATCH 38/47] reduce the resolution of llGetTime and llGetAndResetTime, to 1ms --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a9c57898d7..849d02d7e5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3096,7 +3096,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); double ScriptTime = Util.GetTimeStampMS() - m_timer; - return (ScriptTime / 1000.0); + return (float)Math.Round((ScriptTime / 1000.0), 3); } public void llResetTime() @@ -3111,7 +3111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api double now = Util.GetTimeStampMS(); double ScriptTime = now - m_timer; m_timer = now; - return (ScriptTime / 1000.0); + return (float)Math.Round((ScriptTime / 1000.0), 3); } public void llSound(string sound, double volume, int queue, int loop) From 017069636afd8e0db5a2c81873badcc1f2dc6891 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Sat, 26 Nov 2016 01:15:10 +0000 Subject: [PATCH 39/47] Increase float precision for windlight needed by scripts. mySQL Migration on regionwindlight table. mySQL was setup to store smaller values because the viewers editor capped input, scripts can set higher precision so settings could change on region restart. This change brings mySQL more inline with PGSQL which uses doubles for all windlight floats. --- .../MySQL/Resources/RegionStore.migrations | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 1de5a01cfc..edc04b9a5e 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -390,3 +390,66 @@ CREATE TABLE IF NOT EXISTS `bakedterrain` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; COMMIT; + +:VERSION 55 #----- Increase float precision for windlight needed by scripts + +BEGIN; + +ALTER TABLE `regionwindlight` + +MODIFY `water_fog_density_exponent` float(9,7) unsigned NOT NULL DEFAULT '4.0', +MODIFY `underwater_fog_modifier` float(9,8) unsigned NOT NULL DEFAULT '0.25', +MODIFY `reflection_wavelet_scale_1` float(9,7) unsigned NOT NULL DEFAULT '2.0', +MODIFY `reflection_wavelet_scale_2` float(9,7) unsigned NOT NULL DEFAULT '2.0', +MODIFY `reflection_wavelet_scale_3` float(9,7) unsigned NOT NULL DEFAULT '2.0', +MODIFY `fresnel_scale` float(9,8) unsigned NOT NULL DEFAULT '0.40', +MODIFY `fresnel_offset` float(9,8) unsigned NOT NULL DEFAULT '0.50', +MODIFY `refract_scale_above` float(9,8) unsigned NOT NULL DEFAULT '0.03', +MODIFY `refract_scale_below` float(9,8) unsigned NOT NULL DEFAULT '0.20', +MODIFY `blur_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.040', +MODIFY `big_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.05', +MODIFY `big_wave_direction_y` float(9,8) NOT NULL DEFAULT '-0.42', +MODIFY `little_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.11', +MODIFY `little_wave_direction_y` float(9,8) NOT NULL DEFAULT '-1.16', +MODIFY `horizon_r` float(9,8) unsigned NOT NULL DEFAULT '0.25', +MODIFY `horizon_g` float(9,8) unsigned NOT NULL DEFAULT '0.25', +MODIFY `horizon_b` float(9,8) unsigned NOT NULL DEFAULT '0.32', +MODIFY `horizon_i` float(9,8) unsigned NOT NULL DEFAULT '0.32', +MODIFY `haze_horizon` float(9,8) unsigned NOT NULL DEFAULT '0.19', +MODIFY `blue_density_r` float(9,8) unsigned NOT NULL DEFAULT '0.12', +MODIFY `blue_density_g` float(9,8) unsigned NOT NULL DEFAULT '0.22', +MODIFY `blue_density_b` float(9,8) unsigned NOT NULL DEFAULT '0.38', +MODIFY `blue_density_i` float(9,8) unsigned NOT NULL DEFAULT '0.38', +MODIFY `haze_density` float(9,8) unsigned NOT NULL DEFAULT '0.70', +MODIFY `density_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.18', +MODIFY `distance_multiplier` float(9,6) unsigned NOT NULL DEFAULT '0.8', +MODIFY `sun_moon_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.24', +MODIFY `sun_moon_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.26', +MODIFY `sun_moon_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.30', +MODIFY `sun_moon_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.30', +MODIFY `sun_moon_position` float(9,8) unsigned NOT NULL DEFAULT '0.317', +MODIFY `ambient_r` float(9,8) unsigned NOT NULL DEFAULT '0.35', +MODIFY `ambient_g` float(9,8) unsigned NOT NULL DEFAULT '0.35', +MODIFY `ambient_b` float(9,8) unsigned NOT NULL DEFAULT '0.35', +MODIFY `ambient_i` float(9,8) unsigned NOT NULL DEFAULT '0.35', +MODIFY `east_angle` float(9,8) unsigned NOT NULL DEFAULT '0.00', +MODIFY `sun_glow_focus` float(9,8) unsigned NOT NULL DEFAULT '0.10', +MODIFY `sun_glow_size` float(9,8) unsigned NOT NULL DEFAULT '1.75', +MODIFY `scene_gamma` float(9,7) unsigned NOT NULL DEFAULT '1.00', +MODIFY `star_brightness` float(9,8) unsigned NOT NULL DEFAULT '0.00', +MODIFY `cloud_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.41', +MODIFY `cloud_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.41', +MODIFY `cloud_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.41', +MODIFY `cloud_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.41', +MODIFY `cloud_x` float(9,8) unsigned NOT NULL DEFAULT '1.00', +MODIFY `cloud_y` float(9,8) unsigned NOT NULL DEFAULT '0.53', +MODIFY `cloud_density` float(9,8) unsigned NOT NULL DEFAULT '1.00', +MODIFY `cloud_coverage` float(9,8) unsigned NOT NULL DEFAULT '0.27', +MODIFY `cloud_scale` float(9,8) unsigned NOT NULL DEFAULT '0.42', +MODIFY `cloud_detail_x` float(9,8) unsigned NOT NULL DEFAULT '1.00', +MODIFY `cloud_detail_y` float(9,8) unsigned NOT NULL DEFAULT '0.53', +MODIFY `cloud_detail_density` float(9,8) unsigned NOT NULL DEFAULT '0.12', +MODIFY `cloud_scroll_x` float(9,7) NOT NULL DEFAULT '0.20', +MODIFY `cloud_scroll_y` float(9,7) NOT NULL DEFAULT '0.01'; + +COMMIT; From e60366ce92e9166e75198e555cd8571e1cd3ec6d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 03:29:22 +0000 Subject: [PATCH 40/47] avoid doing unnecessary heavy things on change physics rep --- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 60b24ec891..a50905b839 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -2969,6 +2969,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changePhysRepData(ODEPhysRepData repData) { + if(_size == repData.size && + _pbs == repData.pbs && + m_shapetype == repData.shapetype && + m_mesh == repData.mesh && + primVolume == repData.volume) + return; + CheckDelaySelect(); OdePrim parent = (OdePrim)_parent; From 019910afbdd76a907a7fe3a5c7b9044fae17f4d2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 03:57:33 +0000 Subject: [PATCH 41/47] don't go seach for info we already have at hand.. and there is no region height on osGetRegionSize --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1a594e1c35..a21a0caa4e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3354,8 +3354,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); Scene scene = m_ScriptEngine.World; - GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID); - return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight); + RegionInfo reg = World.RegionInfo; +// GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID); +// return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeY, (float)Constants.RegionHeight); + return new LSL_Vector((float)reg.RegionSizeX, (float)reg.RegionSizeY, 0.0f); } public int osGetSimulatorMemory() From 1e90417ac2edd53a0ece0d69e46750249953791f Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Fri, 25 Nov 2016 06:45:57 +0100 Subject: [PATCH 42/47] Fix in descriptions of: load xml, load xml2, save xml, save xml2 Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- OpenSim/Region/Application/OpenSim.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4ab48e31be..5d21368cca 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -242,22 +242,22 @@ namespace OpenSim ChangeSelectedRegion); m_console.Commands.AddCommand("Archiving", false, "save xml", - "save xml", + "save xml []", "Save a region's data in XML format", SaveXml); m_console.Commands.AddCommand("Archiving", false, "save xml2", - "save xml2", + "save xml2 []", "Save a region's data in XML2 format", SaveXml2); m_console.Commands.AddCommand("Archiving", false, "load xml", - "load xml [-newIDs [ ]]", + "load xml [ [-newUID [ ]]]", "Load a region's data from XML format", LoadXml); m_console.Commands.AddCommand("Archiving", false, "load xml2", - "load xml2", + "load xml2 []", "Load a region's data from XML2 format", LoadXml2); From d2bbd7ef2b31e84099ac401d88fc2a3193d81ed6 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Fri, 25 Nov 2016 06:51:16 +0100 Subject: [PATCH 43/47] Fix in cmdparams.Length for: SavePrimsXml2 and SaveXml Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- OpenSim/Region/Application/OpenSim.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 5d21368cca..cf2bf33231 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1068,7 +1068,7 @@ namespace OpenSim /// protected void SavePrimsXml2(string module, string[] cmdparams) { - if (cmdparams.Length > 5) + if (cmdparams.Length > 4) { SceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]); } @@ -1087,7 +1087,7 @@ namespace OpenSim { MainConsole.Instance.Output("PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); - if (cmdparams.Length > 0) + if (cmdparams.Length > 2) { SceneManager.SaveCurrentSceneToXml(cmdparams[2]); } From b781de73e31b22930a687cd541e48cd1aabfb908 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 04:49:35 +0000 Subject: [PATCH 44/47] mantis 7656, partialy apply patch, changing the start scripts for now --- OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 3c03130bd2..01bc491566 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -265,6 +265,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization foreach (XmlNode aPrimNode in rootNode.ChildNodes) { SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml); + scene.AddNewSceneObject(obj, true); if (startScripts) sceneObjects.Add(obj); } From 5cc0d6620de4dd5c5b532ee284c8f873d0342ecb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 05:08:46 +0000 Subject: [PATCH 45/47] remove 2 more null refs i added to release memory --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 498d5fe7c0..6cdf6f635d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -615,8 +615,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP ImageManager.Close(); ImageManager = null; - m_entityUpdates = null; - m_entityProps = null; + m_entityUpdates = new PriorityQueue(1); + m_entityProps = new PriorityQueue(1); m_killRecord.Clear(); GroupsInView.Clear(); // m_scene = null; can't do this unless checks are added everywhere due to workitems already in pools From 155f8dac1d894b6323197893fa5dc3d61823786d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 27 Nov 2016 02:12:12 +0000 Subject: [PATCH 46/47] BUG fix encoding or region size on HG LinkRegionRequest response --- OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index cb15138465..2d0b2b68f5 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs @@ -79,8 +79,8 @@ namespace OpenSim.Server.Handlers.Hypergrid hash["result"] = success.ToString(); hash["uuid"] = regionID.ToString(); hash["handle"] = regionHandle.ToString(); - hash["size_x"] = sizeX; - hash["size_y"] = sizeY; + hash["size_x"] = sizeX.ToString(); + hash["size_y"] = sizeY.ToString(); hash["region_image"] = imageURL; hash["external_name"] = externalName; From d3cd323f0c5826c3162965a536645abaa5b30f04 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 27 Nov 2016 15:07:14 +0000 Subject: [PATCH 47/47] HG on links request build the URI in http format with a / at end, this should not be needed but is coerent with current serverURI --- OpenSim/Services/GridService/HypergridLinker.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 3b85160df9..28693499a2 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -231,9 +231,10 @@ namespace OpenSim.Services.GridService { regionName = parts[2]; } - - bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); - if (success) + + string serverURI = "http://"+ host +":"+ port.ToString() + "/"; +// bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); + if(TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason)) { regInfo.RegionName = mapName; return regInfo; @@ -257,6 +258,8 @@ namespace OpenSim.Services.GridService } serverURI = parts[0]; + if (!serverURI.EndsWith("/")) + serverURI = serverURI + "/"; if (parts.Length >= 2) {