From b8c19fe1a9dc49a060be7afce6d317d52db1983a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 2 Nov 2012 17:40:17 +0000 Subject: Create a new random when needed using normal time based seed instead of reusing a shared one than may not be valid --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ee61de6..6339522 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -112,7 +112,7 @@ namespace OpenSim.Region.Framework.Scenes private long timeLastChanged = 0; private long m_maxPersistTime = 0; private long m_minPersistTime = 0; - private Random m_rand; +// private Random m_rand; private List m_linkedAvatars = new List(); /// @@ -130,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes { if (value) { + if (m_isBackedUp) { m_scene.SceneGraph.FireChangeBackup(this); @@ -139,13 +140,15 @@ namespace OpenSim.Region.Framework.Scenes timeFirstChanged = DateTime.Now.Ticks; if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) { +/* if (m_rand == null) { byte[] val = new byte[16]; m_rootPart.UUID.ToBytes(val, 0); m_rand = new Random(BitConverter.ToInt32(val, 0)); } - + */ + Random m_rand = new Random(); if (m_scene.GetRootAgentCount() == 0) { //If the region is empty, this change has been made by an automated process -- cgit v1.1 From e642b80a79bc2a5585972caa14a8f5f59a5dc6fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 2 Nov 2012 17:49:54 +0000 Subject: actually remove the use of random on persist timmings --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6339522..e94ecee 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -148,13 +148,13 @@ namespace OpenSim.Region.Framework.Scenes m_rand = new Random(BitConverter.ToInt32(val, 0)); } */ - Random m_rand = new Random(); if (m_scene.GetRootAgentCount() == 0) { //If the region is empty, this change has been made by an automated process //and thus we delay the persist time by a random amount between 1.5 and 2.5. - float factor = 1.5f + (float)(m_rand.NextDouble()); +// float factor = 1.5f + (float)(m_rand.NextDouble()); + float factor = 2.0f; m_maxPersistTime = (long)((float)m_scene.m_persistAfter * factor); m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * factor); } @@ -162,8 +162,10 @@ namespace OpenSim.Region.Framework.Scenes { //If the region is not empty, we want to obey the minimum and maximum persist times //but add a random factor so we stagger the object persistance a little - m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 - m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 +// m_maxPersistTime = (long)((float)m_scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5 +// m_minPersistTime = (long)((float)m_scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0 + m_maxPersistTime = m_scene.m_persistAfter; + m_minPersistTime = m_scene.m_dontPersistBefore; } } } -- cgit v1.1 From 4fa088bafb4c78ad3177b0e944a4312bd6abdea7 Mon Sep 17 00:00:00 2001 From: teravus Date: Sun, 4 Nov 2012 22:57:24 -0500 Subject: Pipe Throttle Update Event to EventManager, client --> ScenePresence --> EventManager, so that modules can know when throttles are updated. The event contains no client specific data to preserve the possibility of 'multiple clients' and you must still call ControllingClient.GetThrottlesPacked(f) to see what the throttles actually are once the event fires. Hook EventManager.OnUpdateThrottle to GetTextureModule. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 13 +++++++++++++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +++++ 2 files changed, 18 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 7916c42..4a19c3b 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -376,6 +376,10 @@ namespace OpenSim.Region.Framework.Scenes public event ParcelPrimCountTainted OnParcelPrimCountTainted; public event GetScriptRunning OnGetScriptRunning; + public delegate void ThrottleUpdate(ScenePresence scenePresence); + + public event ThrottleUpdate OnThrottleUpdate; + /// /// RegisterCapsEvent is called by Scene after the Caps object /// has been instantiated and before it is return to the @@ -2641,5 +2645,14 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerThrottleUpdate(ScenePresence scenePresence) + { + ThrottleUpdate handler = OnThrottleUpdate; + if (handler != null) + { + handler(scenePresence); + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a8aa551..2b9665c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -793,6 +793,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnChangeAnim += avnHandleChangeAnim; ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; ControllingClient.OnAutoPilotGo += MoveToTarget; + ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -3166,6 +3167,10 @@ namespace OpenSim.Region.Framework.Scenes } private static Vector3 marker = new Vector3(-1f, -1f, -1f); + private void RaiseUpdateThrottles() + { + m_scene.EventManager.TriggerThrottleUpdate(this); + } /// /// This updates important decision making data about a child agent /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region -- cgit v1.1