From ef4122213c440c55d32c097c08e52170f4b4346a Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 6 Aug 2012 15:35:40 +0100 Subject: enables configurable minimum sizes for physical & non-physical prims --- OpenSim/Region/Framework/Scenes/Scene.cs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0e5ddfd..d2d6aba 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -103,8 +103,26 @@ namespace OpenSim.Region.Framework.Scenes /// public bool CollidablePrims { get; private set; } + /// + /// Minimum value of the size of a non-physical prim in each axis + /// + public float m_minNonphys = 0.01f; + + /// + /// Maximum value of the size of a non-physical prim in each axis + /// public float m_maxNonphys = 256; + + /// + /// Minimum value of the size of a physical prim in each axis + /// + public float m_minPhys = 0.01f; + + /// + /// Maximum value of the size of a physical prim in each axis + /// public float m_maxPhys = 10; + public bool m_clampPrimSize; public bool m_trustBinaries; public bool m_allowScriptCrossings; @@ -721,14 +739,25 @@ namespace OpenSim.Region.Framework.Scenes PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); + m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys); + if (RegionInfo.NonphysPrimMin > 0) + { + m_minNonphys = RegionInfo.NonphysPrimMin; + } + m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; } - m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); + m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); + if (RegionInfo.PhysPrimMin > 0) + { + m_minPhys = RegionInfo.PhysPrimMin; + } + m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); if (RegionInfo.PhysPrimMax > 0) { m_maxPhys = RegionInfo.PhysPrimMax; -- cgit v1.1 From bcbd450fe441e94d6c0f547055b4e95f75a5b0d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 20 Aug 2012 20:24:54 +0100 Subject: Add --force flag to "kick user" console command to allow bypassing of recent race condition checks. This is to allow a second attempt to remove an avatar even if "show connections" shows them as already inactive (i.e. close has already been attempted once). You should only attempt --force if a normal kick fails. This is partly for diagnostics as we have seen some connections occasionally remain on lbsa plaza even if they are registered as inactive. This is not a permanent solution and may not work anyway - the ultimate solution is to stop this problem from happening in the first place. --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d2d6aba..ad74189 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4116,16 +4116,19 @@ namespace OpenSim.Region.Framework.Scenes /// /// Tell a single agent to disconnect from the region. /// - /// /// - public bool IncomingCloseAgent(UUID agentID) + /// + /// Force the agent to close even if it might be in the middle of some other operation. You do not want to + /// force unless you are absolutely sure that the agent is dead and a normal close is not working. + /// + public bool IncomingCloseAgent(UUID agentID, bool force) { //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { - presence.ControllingClient.Close(); + presence.ControllingClient.Close(force); return true; } -- cgit v1.1 From 476996bee86702227eedd3c953000891027faac4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Aug 2012 22:38:07 +0100 Subject: If a connecting scene presence is replacing an existing scene presence then bypass close checks. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ad74189..2b4dea4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3562,7 +3562,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", sp.Name, sp.UUID, RegionInfo.RegionName); - sp.ControllingClient.Close(); + sp.ControllingClient.Close(true); sp = null; } -- cgit v1.1 From 1eb1c1bd4bc972e2df301b9dafb40fbb2f37b40c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 18:19:51 +0100 Subject: renaming to be similar to equivalent Set command Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fcc2953..5b529c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3737,7 +3737,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", sp.Name, sp.UUID, RegionInfo.RegionName); - sp.ControllingClient.Close(true); + sp.ControllingClient.Close(true, true); sp = null; } -- cgit v1.1 From d2e79e26d7ea99b222a9c432b3727c558cd39f6e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 10:40:37 +0100 Subject: adding utility method for getting SceneObjectPart from scene Signed-off-by: BlueWall --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2b4dea4..1771bf9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4613,6 +4613,18 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Attempt to get a prim via its UUID + /// + /// + /// + /// + public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop) + { + sop = GetSceneObjectPart(fullID); + return sop != null; + } + + /// /// Get a scene object group that contains the prim with the given local id /// /// -- cgit v1.1 From 4215877b4848bd185ec20b50118b36b53cbfd604 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 10:40:26 +0100 Subject: adding utility method for getting SceneObjectGroup from scene Signed-off-by: BlueWall --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1771bf9..a2d553d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4582,6 +4582,18 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Attempt to get the SOG via its UUID + /// + /// + /// + /// + public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog) + { + sog = GetSceneObjectGroup(fullID); + return sog != null; + } + + /// /// Get a prim by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// -- cgit v1.1 From e041f09750419f60c819ee7e7a99044fe43a811c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 11:45:52 +0100 Subject: refactoring to allow Scene.GetLandData to accept Vector3 as an argument. Note that the prior work on LSL_Vector implicit operators means one does not need to explicitly cast a LSL_Vector to Vector3 --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a2d553d..ff3d3af 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4334,6 +4334,16 @@ namespace OpenSim.Region.Framework.Scenes return LandChannel.GetLandObject(x, y).LandData; } + /// + /// Get LandData by position. + /// + /// + /// + public LandData GetLandData(Vector3 pos) + { + return GetLandData(pos.X, pos.Y); + } + public LandData GetLandData(uint x, uint y) { m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); -- cgit v1.1 From 783ee949ea9b9bfe309e542a74bb0712f3b65d00 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 8 Sep 2012 13:48:07 +0100 Subject: implementing per-region configuration of limits on the number of prims one can have in a linkset Applied with changes - patch was based on a repo different from core Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ff3d3af..c2c0b96 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -123,6 +123,11 @@ namespace OpenSim.Region.Framework.Scenes /// public float m_maxPhys = 10; + /// + /// Max prims an object will hold + /// + public int m_linksetCapacity = 0; + public bool m_clampPrimSize; public bool m_trustBinaries; public bool m_allowScriptCrossings; @@ -772,6 +777,12 @@ namespace OpenSim.Region.Framework.Scenes m_clampPrimSize = true; } + m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); + if (RegionInfo.LinksetCapacity > 0) + { + m_linksetCapacity = RegionInfo.LinksetCapacity; + } + m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); -- cgit v1.1 From c7948a669a200af1f18b125c22467f02ecb4784d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 17 Sep 2012 13:03:34 +0100 Subject: preventing a null reference exception from being thrown Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c2c0b96..9c3c53d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5527,6 +5527,9 @@ namespace OpenSim.Region.Framework.Scenes public string GetExtraSetting(string name) { + if (m_extraSettings == null) + return String.Empty; + string val; if (!m_extraSettings.TryGetValue(name, out val)) -- cgit v1.1 From d29fc5305222abcc081daa7aa4b0b017d04bbae1 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 18 Sep 2012 09:47:15 -0400 Subject: Fix some inconsistencies in configurartion: NonPhys prims Fix inconsistencies between configuration parameter names and their description names. Changing the configuration parameters for non physical prim size min-max from Nonphys* to NonPhys*. Please update your OpenSim.ini and Regions.ini to reflect these changes. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9c3c53d..a27e126 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Minimum value of the size of a physical prim in each axis /// - public float m_minPhys = 0.01f; + public float m_minPhys = 0.001f; /// /// Maximum value of the size of a physical prim in each axis @@ -744,13 +744,13 @@ namespace OpenSim.Region.Framework.Scenes PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); - m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys); + m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); if (RegionInfo.NonphysPrimMin > 0) { m_minNonphys = RegionInfo.NonphysPrimMin; } - m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); + m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) { m_maxNonphys = RegionInfo.NonphysPrimMax; -- cgit v1.1 From 9d973ec3b377f51eab4cbd8ef7528d91477fc1d7 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 18 Sep 2012 10:09:32 -0400 Subject: Cleanup from prev. commit Make correct defaults to Phys/nonPhys prims to fix errors in prev. commit --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a27e126..c873cdf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Minimum value of the size of a non-physical prim in each axis /// - public float m_minNonphys = 0.01f; + public float m_minNonphys = 0.001f; /// /// Maximum value of the size of a non-physical prim in each axis @@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Minimum value of the size of a physical prim in each axis /// - public float m_minPhys = 0.001f; + public float m_minPhys = 0.01f; /// /// Maximum value of the size of a physical prim in each axis -- cgit v1.1 From f2a9d26118f87903564990ff220d642801767c25 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 20 Sep 2012 01:40:05 +0100 Subject: Make ResendAppearanceUpdates = true by default in [Appearance] in OpenSimDefaults.ini. This resends appearance uuids to avatars in the scene once a minute. I have seen this help in the past resolve grey appearance problems where viewers have for unknown reasons sometimes ignored the packet. The overhead is very small since only the UUIDs are sent - the viewer then requests the texture only if it does not have it cached. This setting will not help with cloudy avatars which are usually due to the viewer not uploading baked texture data or uploading something that isn't valid JPEG2000 --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c873cdf..e9d1d42 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -861,6 +861,8 @@ namespace OpenSim.Region.Framework.Scenes } // FIXME: Ultimately this should be in a module. + SendPeriodicAppearanceUpdates = true; + IConfig appearanceConfig = m_config.Configs["Appearance"]; if (appearanceConfig != null) { -- cgit v1.1 From 327320d1a7acbba969d26c281f92f64ce8ff365f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 26 Sep 2012 22:49:44 +0100 Subject: Enforce existing 5 action hardcoded undo limit. This was present in the code but not enforced, which led to a memory leak over time as part properties were changed, whether by viewer, script or another source. This commit enforces that limit, which will soon become configurable. Regression test for undo limit added Should help with http://opensimulator.org/mantis/view.php?id=6279 --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e9d1d42..872c061 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -151,7 +151,8 @@ namespace OpenSim.Region.Framework.Scenes // TODO: need to figure out how allow client agents but deny // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; - public int MaxUndoCount = 5; + + public int MaxUndoCount { get; set; } // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; public bool LoginLock = false; @@ -931,6 +932,9 @@ namespace OpenSim.Region.Framework.Scenes WestBorders.Add(westBorder); BordersLocked = false; + // TODO: At some point this should be made configurable. + MaxUndoCount = 5; + m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); -- cgit v1.1 From 2bf42f30af5030890b8e3ff5bb29074a1f0e9085 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 27 Sep 2012 00:12:34 +0100 Subject: Add MaxPrimsUndo config setting to [Startup] section of OpenSim.ini. This controls how many undo steps the simulator will store for each prim. Default is now 20 rather than 5 as it briefly was. The default number could be increased through this is a memory tradeoff which will scale with the number of prims in the sim and level of activity. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 872c061..2e03874 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -742,6 +742,8 @@ namespace OpenSim.Region.Framework.Scenes //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); + MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); + PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); @@ -932,9 +934,6 @@ namespace OpenSim.Region.Framework.Scenes WestBorders.Add(westBorder); BordersLocked = false; - // TODO: At some point this should be made configurable. - MaxUndoCount = 5; - m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); -- cgit v1.1 From 402128bb536ba19bd9c9962146ca04ad493de4e3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Oct 2012 00:51:38 +0100 Subject: Prevent the ExtraSettings code from crashing SQLite driven sims. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2e03874..0a4aa4a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5545,6 +5545,9 @@ namespace OpenSim.Region.Framework.Scenes public void StoreExtraSetting(string name, string val) { + if (m_extraSettings == null) + return; + string oldVal; if (m_extraSettings.TryGetValue(name, out oldVal)) @@ -5562,6 +5565,9 @@ namespace OpenSim.Region.Framework.Scenes public void RemoveExtraSetting(string name) { + if (m_extraSettings == null) + return; + if (!m_extraSettings.ContainsKey(name)) return; -- cgit v1.1 From 03136df1a7f858482ef755d342a33e5b6cfa6ae7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Oct 2012 01:45:49 +0100 Subject: Forgot to actually remove the packetpool set code from scene. --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0a4aa4a..e6b8c16 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -801,13 +801,6 @@ namespace OpenSim.Region.Framework.Scenes SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); - IConfig packetConfig = m_config.Configs["PacketPool"]; - if (packetConfig != null) - { - PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); - PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); - } - m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); -- cgit v1.1 From 6f220a867981db8e3357484feff1fe1977170561 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 5 Oct 2012 17:30:27 -0700 Subject: Trigger ObjectAddedToScene when loading objects from oarfile. Already triggers when creating, duplicating or loading from database, incoming attachments, etc --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e6b8c16..671feda 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2139,7 +2139,14 @@ namespace OpenSim.Region.Framework.Scenes public bool AddRestoredSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) { - return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); + if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; + } /// -- cgit v1.1 From 9be2d5c77da8c2fc6c953e26a8b1412642588eb2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 7 Oct 2012 03:03:24 +0100 Subject: Fix merge issues --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6e3e436..8d112db 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -825,13 +825,6 @@ namespace OpenSim.Region.Framework.Scenes m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); - IConfig packetConfig = m_config.Configs["PacketPool"]; - if (packetConfig != null) - { - PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); - PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); - } - m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); -- cgit v1.1 From a3c0e3ed260a8a76e3009e99162cdcb8142ea1b1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Oct 2012 22:19:47 +0100 Subject: minor: elaborate method doc on Scene.NewUserConnection() --- OpenSim/Region/Framework/Scenes/Scene.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 671feda..ed88571 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3461,11 +3461,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Do the work necessary to initiate a new user connection for a particular scene. - /// At the moment, this consists of setting up the caps infrastructure - /// The return bool should allow for connections to be refused, but as not all calling paths - /// take proper notice of it let, we allowed banned users in still. /// /// CircuitData of the agent who is connecting + /// /// Outputs the reason for the false response on this string /// True if the region accepts this agent. False if it does not. False will /// also return a reason. @@ -3476,10 +3474,20 @@ namespace OpenSim.Region.Framework.Scenes /// /// Do the work necessary to initiate a new user connection for a particular scene. - /// At the moment, this consists of setting up the caps infrastructure + /// + /// + /// The return bool should allow for connections to be refused, but as not all calling paths + /// take proper notice of it yet, we still allowed banned users in. + /// + /// At the moment this method consists of setting up the caps infrastructure /// The return bool should allow for connections to be refused, but as not all calling paths /// take proper notice of it let, we allowed banned users in still. - /// + /// + /// This method is called by the login service (in the case of login) or another simulator (in the case of region + /// cross or teleport) to initiate the connection. It is not triggered by the viewer itself - the connection + /// is activated later when the viewer sends the initial UseCircuitCodePacket UDP packet (in the case of + /// the LLUDP stack). + /// /// CircuitData of the agent who is connecting /// Outputs the reason for the false response on this string /// True for normal presence. False for NPC @@ -3566,7 +3574,6 @@ namespace OpenSim.Region.Framework.Scenes return false; } - ScenePresence sp = GetScenePresence(agent.AgentID); if (sp != null && !sp.IsChildAgent) -- cgit v1.1 From e76b01a201a9b2d45b56cd5dc2a207b08b4529e5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Oct 2012 00:26:43 +0100 Subject: Lock on AgentCircuitData during Scene.AddClient() and RemoveClient() to prevent an inactive connection being left behind if the user closes the viewer whilst the connection is being established. This should remove the need to run the console command "kick user --force" when these connections are left around. --- OpenSim/Region/Framework/Scenes/Scene.cs | 457 +++++++++++++++++-------------- 1 file changed, 256 insertions(+), 201 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ed88571..fb2decc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -80,6 +80,11 @@ namespace OpenSim.Region.Framework.Scenes public SynchronizeSceneHandler SynchronizeScene; /// + /// Used to prevent simultaneous calls to RemoveClient() for the same agent from interfering with each other. + /// + private object m_removeClientLock = new object(); + + /// /// Statistical information for this scene. /// public SimStatsReporter StatsReporter { get; private set; } @@ -2709,69 +2714,89 @@ namespace OpenSim.Region.Framework.Scenes public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) { + ScenePresence sp; + bool vialogin; + // Validation occurs in LLUDPServer + // + // XXX: A race condition exists here where two simultaneous calls to AddNewClient can interfere with + // each other. In practice, this does not currently occur in the code. AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); - bool vialogin - = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 - || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; - -// CheckHeartbeat(); - - ScenePresence sp = GetScenePresence(client.AgentId); - - // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this - // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause - // other problems, and possible the code calling AddNewClient() should ensure that no client is already - // connected. - if (sp == null) - { - m_log.DebugFormat( - "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", - client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); - - m_clientManager.Add(client); - SubscribeToClientEvents(client); - - sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); - m_eventManager.TriggerOnNewPresence(sp); - - sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; + // We lock here on AgentCircuitData to prevent a race condition between the thread adding a new connection + // and a simultaneous one that removes it (as can happen if the client is closed at a particular point + // whilst connecting). + // + // It would be easier to lock across all NewUserConnection(), AddNewClient() and + // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service + // response in some module listening to AddNewClient()) from holding up unrelated agent calls. + // + // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all + // AddNewClient() operations (though not other ops). + // In the future this can be relieved once locking per agent (not necessarily on AgentCircuitData) is improved. + lock (aCircuit) + { + vialogin + = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 + || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; + + // CheckHeartbeat(); + + sp = GetScenePresence(client.AgentId); - // The first agent upon login is a root agent by design. - // For this agent we will have to rez the attachments. - // All other AddNewClient calls find aCircuit.child to be true. - if (aCircuit.child == false) + // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this + // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause + // other problems, and possible the code calling AddNewClient() should ensure that no client is already + // connected. + if (sp == null) { - // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to - // start the scripts again (since this is done in RezAttachments()). - // XXX: This is convoluted. - sp.IsChildAgent = false; - - if (AttachmentsModule != null) - Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); + m_log.DebugFormat( + "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", + client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); + + m_clientManager.Add(client); + SubscribeToClientEvents(client); + + sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); + m_eventManager.TriggerOnNewPresence(sp); + + sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; + + // The first agent upon login is a root agent by design. + // For this agent we will have to rez the attachments. + // All other AddNewClient calls find aCircuit.child to be true. + if (aCircuit.child == false) + { + // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to + // start the scripts again (since this is done in RezAttachments()). + // XXX: This is convoluted. + sp.IsChildAgent = false; + + if (AttachmentsModule != null) + Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); + } } - } - else - { - m_log.WarnFormat( - "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", - sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); - } + else + { + m_log.WarnFormat( + "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", + sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); + } + + // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the + // client is for a root or child agent. + client.SceneAgent = sp; - // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the - // client is for a root or child agent. - client.SceneAgent = sp; + // Cache the user's name + CacheUserName(sp, aCircuit); + + EventManager.TriggerOnNewClient(client); + if (vialogin) + EventManager.TriggerOnClientLogin(client); + } m_LastLogin = Util.EnvironmentTickCount(); - // Cache the user's name - CacheUserName(sp, aCircuit); - - EventManager.TriggerOnNewClient(client); - if (vialogin) - EventManager.TriggerOnClientLogin(client); - return sp; } @@ -3300,109 +3325,129 @@ namespace OpenSim.Region.Framework.Scenes { // CheckHeartbeat(); bool isChildAgent = false; - ScenePresence avatar = GetScenePresence(agentID); - - if (avatar == null) - { - m_log.WarnFormat( - "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); - - return; - } + AgentCircuitData acd; - try + lock (m_removeClientLock) { - isChildAgent = avatar.IsChildAgent; - - m_log.DebugFormat( - "[SCENE]: Removing {0} agent {1} {2} from {3}", - (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); + acd = m_authenticateHandler.GetAgentCircuitData(agentID); - // Don't do this to root agents, it's not nice for the viewer - if (closeChildAgents && isChildAgent) + if (acd == null) { - // Tell a single agent to disconnect from the region. - IEventQueue eq = RequestModuleInterface(); - if (eq != null) - { - eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); - } - else - { - avatar.ControllingClient.SendShutdownConnectionNotice(); - } + m_log.ErrorFormat("[SCENE]: No agent circuit found for {0}, aborting Scene.RemoveClient", agentID); + return; } - - // Only applies to root agents. - if (avatar.ParentID != 0) + else { - avatar.StandUp(); + // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred + // simultaneously. + m_authenticateHandler.RemoveCircuit(acd.circuitcode); } + } - m_sceneGraph.removeUserCount(!isChildAgent); - - // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop - // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI - if (closeChildAgents && CapsModule != null) - CapsModule.RemoveCaps(agentID); - - // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever - // this method is doing is HORRIBLE!!! - avatar.Scene.NeedSceneCacheClear(avatar.UUID); - - if (closeChildAgents && !isChildAgent) + lock (acd) + { + ScenePresence avatar = GetScenePresence(agentID); + + if (avatar == null) { - List regions = avatar.KnownRegionHandles; - regions.Remove(RegionInfo.RegionHandle); - m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); + m_log.WarnFormat( + "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); + + return; } - - m_eventManager.TriggerClientClosed(agentID, this); - m_eventManager.TriggerOnRemovePresence(agentID); - - if (!isChildAgent) + + try { - if (AttachmentsModule != null) + isChildAgent = avatar.IsChildAgent; + + m_log.DebugFormat( + "[SCENE]: Removing {0} agent {1} {2} from {3}", + (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); + + // Don't do this to root agents, it's not nice for the viewer + if (closeChildAgents && isChildAgent) { - AttachmentsModule.DeRezAttachments(avatar); + // Tell a single agent to disconnect from the region. + IEventQueue eq = RequestModuleInterface(); + if (eq != null) + { + eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); + } + else + { + avatar.ControllingClient.SendShutdownConnectionNotice(); + } } - - ForEachClient( - delegate(IClientAPI client) + + // Only applies to root agents. + if (avatar.ParentID != 0) + { + avatar.StandUp(); + } + + m_sceneGraph.removeUserCount(!isChildAgent); + + // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop + // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI + if (closeChildAgents && CapsModule != null) + CapsModule.RemoveCaps(agentID); + + // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever + // this method is doing is HORRIBLE!!! + avatar.Scene.NeedSceneCacheClear(avatar.UUID); + + if (closeChildAgents && !isChildAgent) + { + List regions = avatar.KnownRegionHandles; + regions.Remove(RegionInfo.RegionHandle); + m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); + } + + m_eventManager.TriggerClientClosed(agentID, this); + m_eventManager.TriggerOnRemovePresence(agentID); + + if (!isChildAgent) + { + if (AttachmentsModule != null) { - //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway - try { client.SendKillObject(avatar.RegionHandle, new List { avatar.LocalId }); } - catch (NullReferenceException) { } - }); - } - - // It's possible for child agents to have transactions if changes are being made cross-border. - if (AgentTransactionsModule != null) - AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); + AttachmentsModule.DeRezAttachments(avatar); + } - m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); - } - catch (Exception e) - { - m_log.Error( - string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); - } - finally - { - try - { - // Always clean these structures up so that any failure above doesn't cause them to remain in the - // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering - // the same cleanup exception continually. - m_sceneGraph.RemoveScenePresence(agentID); - m_clientManager.Remove(agentID); + ForEachClient( + delegate(IClientAPI client) + { + //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway + try { client.SendKillObject(avatar.RegionHandle, new List { avatar.LocalId }); } + catch (NullReferenceException) { } + }); + } - avatar.Close(); + // It's possible for child agents to have transactions if changes are being made cross-border. + if (AgentTransactionsModule != null) + AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); } catch (Exception e) { m_log.Error( - string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); + string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); + } + finally + { + try + { + // Always clean these structures up so that any failure above doesn't cause them to remain in the + // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering + // the same cleanup exception continually. + m_sceneGraph.RemoveScenePresence(agentID); + m_clientManager.Remove(agentID); + + avatar.Close(); + } + catch (Exception e) + { + m_log.Error( + string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); + } } } @@ -3572,87 +3617,97 @@ namespace OpenSim.Region.Framework.Scenes agent.firstname, agent.lastname, agent.Viewer); reason = "Access denied, your viewer is banned by the region owner"; return false; - } - - ScenePresence sp = GetScenePresence(agent.AgentID); - - if (sp != null && !sp.IsChildAgent) - { - // We have a zombie from a crashed session. - // Or the same user is trying to be root twice here, won't work. - // Kill it. - m_log.WarnFormat( - "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", - sp.Name, sp.UUID, RegionInfo.RegionName); - - sp.ControllingClient.Close(true); - sp = null; } - ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); + ILandObject land; - //On login test land permisions - if (vialogin) + lock (agent) { - if (land != null && !TestLandRestrictions(agent, land, out reason)) + ScenePresence sp = GetScenePresence(agent.AgentID); + + if (sp != null && !sp.IsChildAgent) { - return false; + // We have a zombie from a crashed session. + // Or the same user is trying to be root twice here, won't work. + // Kill it. + m_log.WarnFormat( + "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", + sp.Name, sp.UUID, RegionInfo.RegionName); + + sp.ControllingClient.Close(true); + sp = null; } - } - - if (sp == null) // We don't have an [child] agent here already - { - if (requirePresenceLookup) + + land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); + + //On login test land permisions + if (vialogin) { - try - { - if (!VerifyUserPresence(agent, out reason)) - return false; - } catch (Exception e) + if (land != null && !TestLandRestrictions(agent, land, out reason)) { - m_log.ErrorFormat( - "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); return false; } } - - try - { - if (!AuthorizeUser(agent, out reason)) - return false; - } catch (Exception e) - { - m_log.ErrorFormat( - "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); - return false; - } - - m_log.InfoFormat( - "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", - RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, - agent.AgentID, agent.circuitcode); - - if (CapsModule != null) + + if (sp == null) // We don't have an [child] agent here already { - CapsModule.SetAgentCapsSeeds(agent); - CapsModule.CreateCaps(agent.AgentID); - } - } else - { - // Let the SP know how we got here. This has a lot of interesting - // uses down the line. - sp.TeleportFlags = (TPFlags)teleportFlags; + if (requirePresenceLookup) + { + try + { + if (!VerifyUserPresence(agent, out reason)) + return false; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); - if (sp.IsChildAgent) - { - m_log.DebugFormat( - "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", - agent.AgentID, RegionInfo.RegionName); + return false; + } + } + + try + { + if (!AuthorizeUser(agent, out reason)) + return false; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); - sp.AdjustKnownSeeds(); - + return false; + } + + m_log.InfoFormat( + "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", + RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, + agent.AgentID, agent.circuitcode); + if (CapsModule != null) + { CapsModule.SetAgentCapsSeeds(agent); + CapsModule.CreateCaps(agent.AgentID); + } + } + else + { + // Let the SP know how we got here. This has a lot of interesting + // uses down the line. + sp.TeleportFlags = (TPFlags)teleportFlags; + + if (sp.IsChildAgent) + { + m_log.DebugFormat( + "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", + agent.AgentID, RegionInfo.RegionName); + + sp.AdjustKnownSeeds(); + + if (CapsModule != null) + CapsModule.SetAgentCapsSeeds(agent); + } } } -- cgit v1.1 From b5a3c74a5cbd1634d021923124a997fc4945e5ef Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Oct 2012 02:52:08 +0100 Subject: Add "active true|false" to "debug scene" console command. This allows the scene update and maintenance loops to be started and stopped for debug purposes. --- OpenSim/Region/Framework/Scenes/Scene.cs | 40 +++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fb2decc..7f4f7e5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -306,6 +306,30 @@ namespace OpenSim.Region.Framework.Scenes } private volatile bool m_shuttingDown; + /// + /// Is the scene active? + /// + /// + /// If false, maintenance and update loops are not run. + /// + public bool Active + { + get { return m_active; } + set + { + if (value) + { + if (!m_active) + Start(); + } + else + { + m_active = false; + } + } + } + private volatile bool m_active; + // private int m_lastUpdate; // private bool m_firstHeartbeat = true; @@ -1159,6 +1183,14 @@ namespace OpenSim.Region.Framework.Scenes public void SetSceneCoreDebug(Dictionary options) { + if (options.ContainsKey("active")) + { + bool active; + + if (bool.TryParse(options["active"], out active)) + Active = active; + } + if (options.ContainsKey("scripting")) { bool enableScripts = true; @@ -1298,6 +1330,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void Start() { + m_active = true; + // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); //m_heartbeatTimer.Enabled = true; @@ -1339,7 +1373,7 @@ namespace OpenSim.Region.Framework.Scenes #region Update Methods /// - /// Performs per-frame updates regularly + /// Activate the various loops necessary to continually update the scene. /// private void Heartbeat() { @@ -1396,7 +1430,7 @@ namespace OpenSim.Region.Framework.Scenes List coarseLocations; List avatarUUIDs; - while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) + while (Active && !m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) { runtc = Util.EnvironmentTickCount(); ++MaintenanceRun; @@ -1455,7 +1489,7 @@ namespace OpenSim.Region.Framework.Scenes int previousFrameTick, tmpMS; int maintc = Util.EnvironmentTickCount(); - while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) + while (Active && !m_shuttingDown && (endFrame == null || Frame < endFrame)) { ++Frame; -- cgit v1.1 From b9c2a1508e68b5580328097a5d5e0b5bfbc16a7d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Oct 2012 03:19:12 +0100 Subject: Fix problems with regression tests by allowing invoke of Update() with a finite number of frames even if the scene isn't active. --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7f4f7e5..fe549bc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -310,7 +310,8 @@ namespace OpenSim.Region.Framework.Scenes /// Is the scene active? /// /// - /// If false, maintenance and update loops are not run. + /// If false, maintenance and update loops are not being run. Updates can still be triggered manually if + /// the scene is not active. /// public bool Active { @@ -1430,7 +1431,7 @@ namespace OpenSim.Region.Framework.Scenes List coarseLocations; List avatarUUIDs; - while (Active && !m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) + while (!m_shuttingDown && ((endRun == null && Active) || MaintenanceRun < endRun)) { runtc = Util.EnvironmentTickCount(); ++MaintenanceRun; @@ -1489,7 +1490,7 @@ namespace OpenSim.Region.Framework.Scenes int previousFrameTick, tmpMS; int maintc = Util.EnvironmentTickCount(); - while (Active && !m_shuttingDown && (endFrame == null || Frame < endFrame)) + while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) { ++Frame; -- cgit v1.1 From d469bde849f53a4c80b301051599390e916ce08a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 16 Oct 2012 01:20:41 +0100 Subject: minor: Add/correct some doc messages associated with entity teleport. I believe UseCircuitCode is sent on EnableSimulator EQ message, rather than EstablishAgentCommunication At least with LL 3.3.4, EstablishAgentCommunication appears unnecessary in the teleport context - viewer still requests it though possibly only after TeleportFinish(). However, we will continue to send it. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fe549bc..5f45529 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4144,8 +4144,9 @@ namespace OpenSim.Region.Framework.Scenes return false; } - // We have to wait until the viewer contacts this region after receiving EAC. - // That calls AddNewClient, which finally creates the ScenePresence + // We have to wait until the viewer contacts this region + // after receiving the EnableSimulator HTTP Event Queue message. This triggers the viewer to send + // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) -- cgit v1.1 From 81aeecc90723658187668baa49bd168b7b333afb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 24 Oct 2012 04:10:22 +0100 Subject: Allow "show object", "show part", "dump object" and "delete object" to accept a local ID as well as a UUID. This means that the sub-commands are now id rather than uuid, e.g. show object id --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5f45529..532598a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4688,13 +4688,24 @@ namespace OpenSim.Region.Framework.Scenes /// Get a group via its UUID /// /// - /// null if no group with that name exists + /// null if no group with that id exists public SceneObjectGroup GetSceneObjectGroup(UUID fullID) { return m_sceneGraph.GetSceneObjectGroup(fullID); } /// + /// Get a group via its local ID + /// + /// This will only return a group if the local ID matches a root part + /// + /// null if no group with that id exists + public SceneObjectGroup GetSceneObjectGroup(uint localID) + { + return m_sceneGraph.GetSceneObjectGroup(localID); + } + + /// /// Get a group by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// -- cgit v1.1 From 22e216fd123744f6c87024fc18f3c9b306777fe2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 22:55:29 +0100 Subject: In Scene.Close(), dispose of the physics scene after base.Close() since script events can still access Physics scene until the script engine shuts down (triggered off base.Close()) XEngine listeners to EventManager.OnShutdown which is triggered from base.Close(). Possibly it could listen for the earlier OnSceneShuttingDown instead, but the easier solution right now is to relocate disposal of the physics scene. This bug has existed since c150320 (Thu Jul 26 15:27:18 2012) and was in 0.7.4 --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 532598a..d48dc11 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1310,6 +1310,14 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGraph.Close(); + if (!GridService.DeregisterRegion(RegionInfo.RegionID)) + m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); + + base.Close(); + + // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence. + // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can + // attempt to reference a null or disposed physics scene. if (PhysicsScene != null) { PhysicsScene phys = PhysicsScene; @@ -1318,12 +1326,6 @@ namespace OpenSim.Region.Framework.Scenes phys.Dispose(); phys = null; } - - if (!GridService.DeregisterRegion(RegionInfo.RegionID)) - m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); - - // call the base class Close method. - base.Close(); } /// -- cgit v1.1 From dc17cee044e0d2d17e8152eb31829c3ad5a99359 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 25 Oct 2012 23:47:13 +0100 Subject: minor: if a scene is already shutting down on Scene.Close(), warn and exit instead of attempting to run another shutdown concurrently. Thanks to Oren Hurvitz for this change. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d48dc11..0f39671 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1267,6 +1267,12 @@ namespace OpenSim.Region.Framework.Scenes // This is the method that shuts down the scene. public override void Close() { + if (m_shuttingDown) + { + m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name); + return; + } + m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); StatsReporter.Close(); -- cgit v1.1 From 2fb89b5aac0369e126234a8189d676d904d0ae33 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Oct 2012 01:15:16 +0100 Subject: Comment out InventoryTransferModule.NeedSceneCacheClear() and invocations since the call itself does nothing and the return value is ignored by all callers. This is a very old method (+4 years) so is probably confusing code cruft. --- OpenSim/Region/Framework/Scenes/Scene.cs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0f39671..9c61fe7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3435,9 +3435,10 @@ namespace OpenSim.Region.Framework.Scenes if (closeChildAgents && CapsModule != null) CapsModule.RemoveCaps(agentID); - // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever - // this method is doing is HORRIBLE!!! - avatar.Scene.NeedSceneCacheClear(avatar.UUID); +// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever +// // this method is doing is HORRIBLE!!! + // Commented pending deletion since this method no longer appears to do anything at all +// avatar.Scene.NeedSceneCacheClear(avatar.UUID); if (closeChildAgents && !isChildAgent) { @@ -4873,14 +4874,15 @@ namespace OpenSim.Region.Framework.Scenes client.SendRegionHandle(regionID, handle); } - public bool NeedSceneCacheClear(UUID agentID) - { - IInventoryTransferModule inv = RequestModuleInterface(); - if (inv == null) - return true; - - return inv.NeedSceneCacheClear(agentID, this); - } +// Commented pending deletion since this method no longer appears to do anything at all +// public bool NeedSceneCacheClear(UUID agentID) +// { +// IInventoryTransferModule inv = RequestModuleInterface(); +// if (inv == null) +// return true; +// +// return inv.NeedSceneCacheClear(agentID, this); +// } public void CleanTempObjects() { -- cgit v1.1 From 5a96ef52cb552c835cc109cb005db989eade5803 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 28 Oct 2012 18:41:47 +0000 Subject: Deep copy the collection of at_target objects so it can't be modified while it's being iterated --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9c61fe7..2cdc4b3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1692,9 +1692,12 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAtTargets() { - Dictionary.ValueCollection objs; + List objs = new List(); lock (m_groupsWithTargets) - objs = m_groupsWithTargets.Values; + { + foreach (SceneObjectGroup grp in m_groupsWithTargets.Values) + objs.Add(grp); + } foreach (SceneObjectGroup entry in objs) entry.checkAtTargets(); -- cgit v1.1 From 09f4e72d6af4b86238af516b1719ff4f63aa7174 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 29 Oct 2012 23:22:40 +0000 Subject: Fix memory leak where removing an NPC did not remove its circuits. This was because we were removing by circuitcode where NPCs have no code. Now removing by agent ID instead. This commit also fixes the "show circuits" console command to work properly where the circuit has no associated IP address. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2cdc4b3..7d8cbf5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3384,9 +3384,10 @@ namespace OpenSim.Region.Framework.Scenes } else { - // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred + // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred // simultaneously. - m_authenticateHandler.RemoveCircuit(acd.circuitcode); + // We also need to remove by agent ID since NPCs will have no circuit code. + m_authenticateHandler.RemoveCircuit(agentID); } } -- cgit v1.1 From 984faf24dfaea26cdd436c8097abf334b74ebed8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 30 Oct 2012 01:48:05 +0000 Subject: Only create a new list to check if objects have reached targets if there actually are any targets. --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7d8cbf5..69c1027 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1692,15 +1692,19 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAtTargets() { - List objs = new List(); + List objs = null; + lock (m_groupsWithTargets) { - foreach (SceneObjectGroup grp in m_groupsWithTargets.Values) - objs.Add(grp); + if (m_groupsWithTargets.Count != 0) + objs = new List(m_groupsWithTargets.Values); } - foreach (SceneObjectGroup entry in objs) - entry.checkAtTargets(); + if (objs != null) + { + foreach (SceneObjectGroup entry in objs) + entry.checkAtTargets(); + } } /// -- cgit v1.1 From 8c130bcaf5a60fa042d8df38ba1d1e1cb328d768 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 12 Nov 2012 22:50:28 +0000 Subject: Remove the old style module loader and all references to it --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 69c1027..db45d6b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -176,7 +176,6 @@ namespace OpenSim.Region.Framework.Scenes protected List m_regionRestartNotifyList = new List(); protected List m_neighbours = new List(); protected string m_simulatorVersion = "OpenSimulator Server"; - protected ModuleLoader m_moduleLoader; protected AgentCircuitManager m_authenticateHandler; protected SceneCommunicationService m_sceneGridService; @@ -659,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, - ModuleLoader moduleLoader, bool dumpAssetsToFile, + bool dumpAssetsToFile, IConfigSource config, string simulatorVersion) : this(regInfo) { @@ -670,7 +669,6 @@ namespace OpenSim.Region.Framework.Scenes Random random = new Random(); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); - m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; m_SimulationDataService = simDataService; -- cgit v1.1 From 8c8c8a00a47b61fcfd4a500ac8f13aa1aafaad26 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 02:22:30 +0000 Subject: Fix problem where restarting the currently selected region would stop various console commands (e.g. "show users") from working. This was because the "currently selected" scene reference was being left as the dead scene instead of the restarted Scene object. --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index db45d6b..8ef22bd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1134,15 +1134,9 @@ namespace OpenSim.Region.Framework.Scenes } } - m_log.Error("[REGION]: Closing"); - Close(); + m_log.InfoFormat("[REGION]: Restarting region {0}", Name); - if (PhysicsScene != null) - { - PhysicsScene.Dispose(); - } - - m_log.Error("[REGION]: Firing Region Restart Message"); + Close(); base.Restart(); } -- cgit v1.1