From 8010413e645e1aaf655008e216c017943a5d8c76 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 21:06:42 +0000 Subject: 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(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8ba26e8..55d4e39 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 e85cee2..0efa7c5 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; } /// -- cgit v1.1 From b887b7625e03a3923e8eea72353c878bc1d4b3a9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 21:53:09 +0000 Subject: change OutPacket drop condition --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 55d4e39..05a3191 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) { -- cgit v1.1 From 586c81eecda0193e3403135ad308f8e9887f1456 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 01:49:53 +0000 Subject: give up on OutPacket drop condition on closing --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 05a3191..5879e56 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())) -- cgit v1.1 From 200183caf7c3673e914a7b7f30fbb47bc7e92c44 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 02:49:40 +0000 Subject: HG protocol is still broken for large regions. work around it on teleport via lm --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - .../CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 0efa7c5..c804e33 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 a9aaf12..49307f6 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, -- cgit v1.1 From 902e8019de4c61379e3dc51f506bd4a1af0a9df3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 05:06:50 +0000 Subject: HG add a small delay before start sending region data --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2cfdd94..7efd920 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; -- cgit v1.1 From f1958e9f71f5ba9b8ca088f23df68336a3c7b43c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 13:36:34 +0000 Subject: 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(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5879e56..65a341e 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 c804e33..dc8ac3c 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(); } -- cgit v1.1 From b70e48c8a5e13074480bdd89a810ff8c73dc8afb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 22:09:33 +0000 Subject: 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(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 71a0e52..1161571 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 49307f6..a9aaf12 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, -- cgit v1.1 From b2c553b459a8390aaadd8f7c65567b1e557226c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:16:35 +0000 Subject: work around some warnings --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 + .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 5 +++++ .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 22 ++++++++++++++-------- 4 files changed, 21 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index dc8ac3c..9449ffb 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 af33d17..a868e3a 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 7171974..4d726b4 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 d4603f8..cac57b2 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); } /// -- cgit v1.1 From f794ab1a6702cdfc073eec17168c280891b941b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:22:01 +0000 Subject: remove something VS decided to add --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9449ffb..dc8ac3c 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 -- cgit v1.1 From bced98d6e9b5fe08fd50a1be88c10a83063c309e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:47:09 +0000 Subject: work around some more warnings --- .../AgentPreferences/RemoteAgentPreferencesServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs index ad9544a..a827c4c 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) -- cgit v1.1 From 4e64445c39c3de1941e071ff32d06702a3440d5d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 05:18:06 +0000 Subject: 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 ++--- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c349369..09f0b19 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 e643db7..0cd738d 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 9d1dca2..3a06e7d 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 d725907..7129c8a 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) -- cgit v1.1 From 385a265971372a556a94ef5f96ea61f9065c041d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 09:35:37 +0000 Subject: supress some warnings by explict(confirm) the hide of parent fields --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 2 -- .../OptionalModules/Avatar/Concierge/ConciergeModule.cs | 14 +++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index fe0a243..5164289 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 c48e585..c4a70c0 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; -- cgit v1.1 From b43717a39721adf14cb84d9d43055036b605a060 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 22 Nov 2016 11:47:50 +0000 Subject: Coding standards: A local variable may not use the prefix m_ --- .../Avatar/Concierge/ConciergeModule.cs | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index c4a70c0..6c147f4 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); -- cgit v1.1 From 94e48838d5b1f0bf0c5b0e40b7bc9a6f1be156e9 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 22 Nov 2016 15:31:45 +0000 Subject: 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. --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 4 ++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1161571..23cfde5 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 7efd920..2cf0e9d 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( -- cgit v1.1 From 34d9596f9ba091c98130333e572d0cba8dd4ffeb Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 22 Nov 2016 15:33:34 +0000 Subject: Fix typo in a comment --- .../Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 23cfde5..33aa7ad 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) { -- cgit v1.1 From f4745e5a354871c5b248d10bb57f40cae5cc788c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 22:24:54 +0000 Subject: 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 --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 52 +------- .../ServiceThrottle/ServiceThrottleModule.cs | 140 +++------------------ .../UserManagement/UserManagementModule.cs | 7 +- 3 files changed, 24 insertions(+), 175 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 65a341e..f472dba 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 3abacbd..36fb57a 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 72fff22..5507526 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( -- cgit v1.1 From 82ed6bde6e7258ee8380a2e8466d4a7e32c9e5e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 10:00:56 +0000 Subject: fix maturity on parcelInfo --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f472dba..498d5fe 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)) -- cgit v1.1 From 72e20028d1a5c7bedfcde56429d211d8e427c7a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 20:26:14 +0000 Subject: safeguard against unknown material replacemet --- OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 006b730..7312bc3 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) -- cgit v1.1 From 94ec5884b7d3cfe350725d5734d227fa1becee94 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 22:15:59 +0000 Subject: fix llRez(AtRoot/Object) error messages on shared code path --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index af04951..3db5dd2 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); -- cgit v1.1 From f9b62b5680be1935857e9517b1a6bcd770c7b683 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 24 Nov 2016 20:53:04 +0000 Subject: 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 --- .../CoreModules/World/Land/LandManagementModule.cs | 53 +++++++++++++++------- .../Shared/Api/Implementation/OSSL_Api.cs | 4 +- 2 files changed, 39 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 11a6d9f..98f1f3b 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 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) + 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); + 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 + + else if (hash.ContainsKey("region_handle")) { - // 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 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"]); + 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 57bff6e..1a594e1 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; -- cgit v1.1 From e45245d267a91a5f79f0e54351d4e24b8c1690c0 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Thu, 24 Nov 2016 23:40:20 +0100 Subject: Implementation of LSL_Integer llScaleByFactor(double scaling_factor) Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/LSL_Api.cs | 46 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++ 3 files changed, 52 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3db5dd2..b5abdb5 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 3d1482d..ea0b6f9 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 2769712..6aaf930 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); -- cgit v1.1 From b82a41d2606dfaf42455e0030b5640752167162b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Nov 2016 17:34:19 +0000 Subject: change llScaleByFactor (sorry Mandarinka). --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 97 ++++++++++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 39 ++------- 2 files changed, 106 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0cd738d..739d23d 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 b5abdb5..c43aef5 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 (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) + if(scaling_factor < 1e-6) return ScriptBaseClass.FALSE; - - if (group.RootPart.KeyframeMotion != null) + if(scaling_factor > 1e6) 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 (group == null || group.IsDeleted || group.inTransit) + return ScriptBaseClass.FALSE; - if (!prim.IsRoot) - { - position = GetSetPosTarget(prim, scaling_factor * position, position, true); - prim.OffsetPosition = position; - prim.ScheduleTerseUpdate(); - } + if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical) + return ScriptBaseClass.FALSE; - SetScale(prim, new_size); - } + if (group.RootPart.KeyframeMotion != null) + return ScriptBaseClass.FALSE; + if(group.GroupResize(scaling_factor)) return ScriptBaseClass.TRUE; - } else - { return ScriptBaseClass.FALSE; - } } public void llSetScale(LSL_Vector scale) -- cgit v1.1 From 935510d87956f080f1425982b3da918009c32feb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Nov 2016 18:35:23 +0000 Subject: add llGetMaxScaleFactor and llGetMinScaleFactor --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 77 ++++++++++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 10 +++ 4 files changed, 111 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 739d23d..6cdbac5 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 c43aef5..a9c5789 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 ea0b6f9..cc52403 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 6aaf930..9d36341 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); -- cgit v1.1 From 6f1080368d23d8e3952b5ffd3c3cc05f540d6402 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 25 Nov 2016 21:37:33 +0000 Subject: reduce the resolution of llGetTime and llGetAndResetTime, to 1ms --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a9c5789..849d02d 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) -- cgit v1.1 From e60366ce92e9166e75198e555cd8571e1cd3ec6d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 03:29:22 +0000 Subject: avoid doing unnecessary heavy things on change physics rep --- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 60b24ec..a50905b 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; -- cgit v1.1 From 019910afbdd76a907a7fe3a5c7b9044fae17f4d2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 03:57:33 +0000 Subject: don't go seach for info we already have at hand.. and there is no region height on osGetRegionSize --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1a594e1..a21a0ca 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() -- cgit v1.1 From 1e90417ac2edd53a0ece0d69e46750249953791f Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Fri, 25 Nov 2016 06:45:57 +0100 Subject: 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(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4ab48e3..5d21368 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); -- cgit v1.1 From d2bbd7ef2b31e84099ac401d88fc2a3193d81ed6 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Fri, 25 Nov 2016 06:51:16 +0100 Subject: 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(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 5d21368..cf2bf33 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]); } -- cgit v1.1 From b781de73e31b22930a687cd541e48cd1aabfb908 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 04:49:35 +0000 Subject: mantis 7656, partialy apply patch, changing the start scripts for now --- OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 3c03130..01bc491 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); } -- cgit v1.1 From 5cc0d6620de4dd5c5b532ee284c8f873d0342ecb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 05:08:46 +0000 Subject: 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(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 498d5fe..6cdf6f6 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 -- cgit v1.1