From f7b28dd32155eac2d55ccf0757b059794d6b5f67 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 7 Sep 2010 03:41:29 +0100 Subject: If a scene object part UUID is changed (only possible when not in a scene), then adjust the inventory items to point to the new uuid as well --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++++++-- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3ed74e1..3753dcb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes public UUID UUID { get { return m_uuid; } - set { m_uuid = value; } + set + { + m_uuid = value; + + // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part + if (Inventory != null) + Inventory.ResetInventoryIDs(); + } } public uint LocalId @@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes UUID = UUID.Random(); LinkNum = linkNum; LocalId = 0; - Inventory.ResetInventoryIDs(); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index ca089a1..87c4860 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes /// Link number for the part public void ResetInventoryIDs() { + if (null == m_part || null == m_part.ParentGroup) + return; + lock (m_items) { if (0 == m_items.Count) -- cgit v1.1 From 9be1c0ff448d4ea650ca921937905653b4017d61 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 14:41:13 -0700 Subject: * Cache null account responses in the SimianUserAccountServiceConnector to avoid repeated requests for missing avatar IDs * Updated to OpenMetaverse r3442 to fix a timezone issue with ExpiringCache --- OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index da8199d..5e491c2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) { - AssetNotecard nc = new AssetNotecard("Hello World!"); + AssetNotecard nc = new AssetNotecard(); + nc.BodyText = "Hello World!"; + nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset -- cgit v1.1 From dd277a0d02f1aa79f4fcb5d108cbc696e90500c2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 10 Sep 2010 12:04:12 -0700 Subject: First pass at cleaning up thread safety in EntityManager and SceneGraph --- OpenSim/Region/Framework/Scenes/EntityManager.cs | 210 ++++------------ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 16 +- OpenSim/Region/Framework/Scenes/Scene.cs | 45 ++-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 263 ++++++++++----------- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 3 +- .../Scenes/Serialization/SceneXmlLoader.cs | 23 +- 7 files changed, 219 insertions(+), 344 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index 099fcce..85d0a4f 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs @@ -34,187 +34,89 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes { - public class EntityManager : IEnumerable + public class EntityManager //: IEnumerable { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly Dictionary m_eb_uuid = new Dictionary(); - private readonly Dictionary m_eb_localID = new Dictionary(); - //private readonly Dictionary m_pres_uuid = new Dictionary(); - private readonly Object m_lock = new Object(); + private readonly DoubleDictionary m_entities = new DoubleDictionary(); - [Obsolete("Use Add() instead.")] - public void Add(UUID id, EntityBase eb) + public int Count { - Add(eb); + get { return m_entities.Count; } } public void Add(EntityBase entity) { - lock (m_lock) - { - try - { - m_eb_uuid.Add(entity.UUID, entity); - m_eb_localID.Add(entity.LocalId, entity); - } - catch(Exception e) - { - m_log.ErrorFormat("Add Entity failed: {0}", e.Message); - } - } - } - - public void InsertOrReplace(EntityBase entity) - { - lock (m_lock) - { - try - { - m_eb_uuid[entity.UUID] = entity; - m_eb_localID[entity.LocalId] = entity; - } - catch(Exception e) - { - m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message); - } - } + m_entities.Add(entity.UUID, entity.LocalId, entity); } public void Clear() { - lock (m_lock) - { - m_eb_uuid.Clear(); - m_eb_localID.Clear(); - } - } - - public int Count - { - get - { - return m_eb_uuid.Count; - } + m_entities.Clear(); } public bool ContainsKey(UUID id) { - try - { - return m_eb_uuid.ContainsKey(id); - } - catch - { - return false; - } + return m_entities.ContainsKey(id); } public bool ContainsKey(uint localID) { - try - { - return m_eb_localID.ContainsKey(localID); - } - catch - { - return false; - } + return m_entities.ContainsKey(localID); } public bool Remove(uint localID) { - lock (m_lock) - { - try - { - bool a = false; - EntityBase entity; - if (m_eb_localID.TryGetValue(localID, out entity)) - a = m_eb_uuid.Remove(entity.UUID); - - bool b = m_eb_localID.Remove(localID); - return a && b; - } - catch (Exception e) - { - m_log.ErrorFormat("Remove Entity failed for {0}", localID, e); - return false; - } - } + return m_entities.Remove(localID); } public bool Remove(UUID id) { - lock (m_lock) - { - try - { - bool a = false; - EntityBase entity; - if (m_eb_uuid.TryGetValue(id, out entity)) - a = m_eb_localID.Remove(entity.LocalId); - - bool b = m_eb_uuid.Remove(id); - return a && b; - } - catch (Exception e) - { - m_log.ErrorFormat("Remove Entity failed for {0}", id, e); - return false; - } - } + return m_entities.Remove(id); } - public List GetAllByType() + public EntityBase[] GetAllByType() { List tmp = new List(); - lock (m_lock) - { - try + m_entities.ForEach( + delegate(EntityBase entity) { - foreach (KeyValuePair pair in m_eb_uuid) - { - if (pair.Value is T) - { - tmp.Add(pair.Value); - } - } + if (entity is T) + tmp.Add(entity); } - catch (Exception e) - { - m_log.ErrorFormat("GetAllByType failed for {0}", e); - tmp = null; - } - } + ); - return tmp; + return tmp.ToArray(); } - public List GetEntities() + public EntityBase[] GetEntities() { - lock (m_lock) - { - return new List(m_eb_uuid.Values); - } + List tmp = new List(m_entities.Count); + m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); }); + return tmp.ToArray(); + } + + public void ForEach(Action action) + { + m_entities.ForEach(action); + } + + public EntityBase Find(Predicate predicate) + { + return m_entities.FindValue(predicate); } public EntityBase this[UUID id] { get { - lock (m_lock) - { - EntityBase entity; - if (m_eb_uuid.TryGetValue(id, out entity)) - return entity; - else - return null; - } + EntityBase entity; + m_entities.TryGetValue(id, out entity); + return entity; } set { - InsertOrReplace(value); + Add(value); } } @@ -222,50 +124,38 @@ namespace OpenSim.Region.Framework.Scenes { get { - lock (m_lock) - { - EntityBase entity; - if (m_eb_localID.TryGetValue(localID, out entity)) - return entity; - else - return null; - } + EntityBase entity; + m_entities.TryGetValue(localID, out entity); + return entity; } set { - InsertOrReplace(value); + Add(value); } } public bool TryGetValue(UUID key, out EntityBase obj) { - lock (m_lock) - { - return m_eb_uuid.TryGetValue(key, out obj); - } + return m_entities.TryGetValue(key, out obj); } public bool TryGetValue(uint key, out EntityBase obj) { - lock (m_lock) - { - return m_eb_localID.TryGetValue(key, out obj); - } + return m_entities.TryGetValue(key, out obj); } /// /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. /// /// - public IEnumerator GetEnumerator() - { - return GetEntities().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - + //public IEnumerator GetEnumerator() + //{ + // return GetEntities().GetEnumerator(); + //} + + //IEnumerator IEnumerable.GetEnumerator() + //{ + // return GetEnumerator(); + //} } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c49386a..a439eb9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); - foreach (EntityBase group in Entities) + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase group in entities) { if (group is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c511774..2f69476 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) @@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) @@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 82e7d76..7ce95a7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1029,29 +1029,30 @@ namespace OpenSim.Region.Framework.Scenes if (ScriptEngine) { m_log.Info("Stopping all Scripts in Scene"); - foreach (EntityBase ent in Entities) + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { if (ent is SceneObjectGroup) - { - ((SceneObjectGroup) ent).RemoveScriptInstances(false); - } + ((SceneObjectGroup)ent).RemoveScriptInstances(false); } } else { m_log.Info("Starting all Scripts in Scene"); - lock (Entities) + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - foreach (EntityBase ent in Entities) + if (ent is SceneObjectGroup) { - if (ent is SceneObjectGroup) - { - ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); - ((SceneObjectGroup)ent).ResumeScripts(); - } + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); } } } + m_scripts_enabled = !ScriptEngine; m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); } @@ -1098,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes shuttingdown = true; m_log.Debug("[SCENE]: Persisting changed objects"); - List entities = GetEntities(); + EntityBase[] entities = GetEntities(); foreach (EntityBase entity in entities) { if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) @@ -2037,8 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes { lock (Entities) { - ICollection entities = new List(Entities); - + EntityBase[] entities = Entities.GetEntities(); foreach (EntityBase e in entities) { if (e is SceneObjectGroup) @@ -3977,9 +3977,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void ForceClientUpdate() { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -3997,9 +3996,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -4368,7 +4366,7 @@ namespace OpenSim.Region.Framework.Scenes /// will not affect the original list of objects in the scene. /// /// - public List GetEntities() + public EntityBase[] GetEntities() { return m_sceneGraph.GetEntities(); } @@ -4402,9 +4400,8 @@ namespace OpenSim.Region.Framework.Scenes public void CleanTempObjects() { - List objs = GetEntities(); - - foreach (EntityBase obj in objs) + EntityBase[] entities = GetEntities(); + foreach (EntityBase obj in entities) { if (obj is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index dfb26b9..3d3e822 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -348,68 +348,57 @@ namespace OpenSim.Region.Framework.Scenes if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) return false; - lock (sceneObject) - { - if (Entities.ContainsKey(sceneObject.UUID)) - { -// m_log.WarnFormat( -// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", -// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); - return false; - } - -// m_log.DebugFormat( -// "[SCENE GRAPH]: Adding object {0} {1} to region {2}", -// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); - - lock (sceneObject.Children) + if (Entities.ContainsKey(sceneObject.UUID)) + return false; + + // Clamp child prim sizes and add child prims to the m_numPrim count + lock (sceneObject.Children) + { + if (m_parentScene.m_clampPrimSize) { - if (m_parentScene.m_clampPrimSize) + foreach (SceneObjectPart part in sceneObject.Children.Values) { - foreach (SceneObjectPart part in sceneObject.Children.Values) - { - Vector3 scale = part.Shape.Scale; - - if (scale.X > m_parentScene.m_maxNonphys) - scale.X = m_parentScene.m_maxNonphys; - if (scale.Y > m_parentScene.m_maxNonphys) - scale.Y = m_parentScene.m_maxNonphys; - if (scale.Z > m_parentScene.m_maxNonphys) - scale.Z = m_parentScene.m_maxNonphys; - - part.Shape.Scale = scale; - } + Vector3 scale = part.Shape.Scale; + + if (scale.X > m_parentScene.m_maxNonphys) + scale.X = m_parentScene.m_maxNonphys; + if (scale.Y > m_parentScene.m_maxNonphys) + scale.Y = m_parentScene.m_maxNonphys; + if (scale.Z > m_parentScene.m_maxNonphys) + scale.Z = m_parentScene.m_maxNonphys; + + part.Shape.Scale = scale; } - - m_numPrim += sceneObject.Children.Count; } - - sceneObject.AttachToScene(m_parentScene); - if (sendClientUpdates) - sceneObject.ScheduleGroupForFullUpdate(); - - Entities.Add(sceneObject); + m_numPrim += sceneObject.Children.Count; + } - if (attachToBackup) - sceneObject.AttachToBackup(); + sceneObject.AttachToScene(m_parentScene); - if (OnObjectCreate != null) - OnObjectCreate(sceneObject); - - lock (SceneObjectGroupsByFullID) - { - SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByFullID[part.UUID] = sceneObject; - } - - lock (SceneObjectGroupsByLocalID) - { - SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; - } + if (sendClientUpdates) + sceneObject.ScheduleGroupForFullUpdate(); + + Entities.Add(sceneObject); + + if (attachToBackup) + sceneObject.AttachToBackup(); + + if (OnObjectCreate != null) + OnObjectCreate(sceneObject); + + lock (SceneObjectGroupsByFullID) + { + SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByFullID[part.UUID] = sceneObject; + } + + lock (SceneObjectGroupsByLocalID) + { + SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; } return true; @@ -421,42 +410,38 @@ namespace OpenSim.Region.Framework.Scenes /// true if the object was deleted, false if there was no object to delete public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) { - if (Entities.ContainsKey(uuid)) - { - SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; + EntityBase entity; + if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) + return false; - if (!resultOfObjectLinked) - { - m_numPrim -= grp.PrimCount; + SceneObjectGroup grp = (SceneObjectGroup)entity; - if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) - RemovePhysicalPrim(grp.PrimCount); - } + if (!resultOfObjectLinked) + { + m_numPrim -= grp.PrimCount; - if (OnObjectRemove != null) - OnObjectRemove(Entities[uuid]); + if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) + RemovePhysicalPrim(grp.PrimCount); + } - lock (SceneObjectGroupsByFullID) - { - foreach (SceneObjectPart part in grp.Children.Values) - SceneObjectGroupsByFullID.Remove(part.UUID); - SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); - } - lock (SceneObjectGroupsByLocalID) - { - foreach (SceneObjectPart part in grp.Children.Values) - SceneObjectGroupsByLocalID.Remove(part.LocalId); - SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); - } + if (OnObjectRemove != null) + OnObjectRemove(Entities[uuid]); - Entities.Remove(uuid); - //SceneObjectGroup part; - //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) + lock (SceneObjectGroupsByFullID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByFullID.Remove(part.UUID); + SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); + } - return true; + lock (SceneObjectGroupsByLocalID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByLocalID.Remove(part.LocalId); + SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); } - return false; + return Entities.Remove(uuid); } /// @@ -468,9 +453,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal void AddToUpdateList(SceneObjectGroup obj) { lock (m_updateList) - { m_updateList[obj.UUID] = obj; - } } /// @@ -480,34 +463,39 @@ namespace OpenSim.Region.Framework.Scenes { if (!Monitor.TryEnter(m_updateLock)) return; - - List updates; - - // Some updates add more updates to the updateList. - // Get the current list of updates and clear the list before iterating - lock (m_updateList) - { - updates = new List(m_updateList.Values); - m_updateList.Clear(); - } - - // Go through all updates - for (int i = 0; i < updates.Count; i++) + try { - SceneObjectGroup sog = updates[i]; + List updates; - // Don't abort the whole update if one entity happens to give us an exception. - try + // Some updates add more updates to the updateList. + // Get the current list of updates and clear the list before iterating + lock (m_updateList) { - sog.Update(); + updates = new List(m_updateList.Values); + m_updateList.Clear(); } - catch (Exception e) + + // Go through all updates + for (int i = 0; i < updates.Count; i++) { - m_log.ErrorFormat( - "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); + SceneObjectGroup sog = updates[i]; + + // Don't abort the whole update if one entity happens to give us an exception. + try + { + sog.Update(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); + } } } - Monitor.Exit(m_updateLock); + finally + { + Monitor.Exit(m_updateLock); + } } protected internal void AddPhysicalPrim(int number) @@ -864,8 +852,9 @@ namespace OpenSim.Region.Framework.Scenes /// null if no scene object group containing that prim is found public SceneObjectGroup GetGroupByPrim(uint localID) { - if (Entities.ContainsKey(localID)) - return Entities[localID] as SceneObjectGroup; + EntityBase entity; + if (Entities.TryGetValue(localID, out entity)) + return entity as SceneObjectGroup; //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; @@ -879,23 +868,22 @@ namespace OpenSim.Region.Framework.Scenes } } - List EntityList = GetEntities(); - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { //m_log.DebugFormat("Looking at entity {0}", ent.UUID); if (ent is SceneObjectGroup) { - if (((SceneObjectGroup)ent).HasChildPrim(localID)) + sog = (SceneObjectGroup)ent; + if (sog.HasChildPrim(localID)) { - sog = (SceneObjectGroup)ent; lock (SceneObjectGroupsByLocalID) - { SceneObjectGroupsByLocalID[localID] = sog; - } return sog; } } } + return null; } @@ -921,23 +909,21 @@ namespace OpenSim.Region.Framework.Scenes } } - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { - if (((SceneObjectGroup)ent).HasChildPrim(fullID)) + sog = (SceneObjectGroup)ent; + if (sog.HasChildPrim(fullID)) { - sog = (SceneObjectGroup)ent; lock (SceneObjectGroupsByFullID) - { SceneObjectGroupsByFullID[fullID] = sog; - } return sog; } } } + return null; } @@ -946,7 +932,7 @@ namespace OpenSim.Region.Framework.Scenes // Primitive Ray Tracing float closestDistance = 280f; EntityIntersection result = new EntityIntersection(); - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); foreach (EntityBase ent in EntityList) { if (ent is SceneObjectGroup) @@ -984,23 +970,28 @@ namespace OpenSim.Region.Framework.Scenes /// null if the part was not found protected internal SceneObjectPart GetSceneObjectPart(string name) { - List EntityList = GetEntities(); + SceneObjectPart sop = null; - // FIXME: use a dictionary here - foreach (EntityBase ent in EntityList) - { - if (ent is SceneObjectGroup) + Entities.Find( + delegate(EntityBase entity) { - foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) + if (entity is SceneObjectGroup) { - if (p.Name == name) + foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts()) { - return p; + if (p.Name == name) + { + sop = p; + return true; + } } } + + return false; } - } - return null; + ); + + return sop; } /// @@ -1021,7 +1012,7 @@ namespace OpenSim.Region.Framework.Scenes /// it /// /// - protected internal List GetEntities() + protected internal EntityBase[] GetEntities() { return Entities.GetEntities(); } @@ -1030,7 +1021,7 @@ namespace OpenSim.Region.Framework.Scenes { Dictionary topScripts = new Dictionary(); - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); int limit = 0; foreach (EntityBase ent in EntityList) { @@ -1726,8 +1717,8 @@ namespace OpenSim.Region.Framework.Scenes UUID objid = UUID.Zero; SceneObjectPart obj = null; - List EntityList = GetEntities(); - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index f478a4a..7aa5a93 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -75,7 +75,8 @@ namespace OpenSim.Region.Framework.Scenes lock(m_pendingObjects) { - foreach (EntityBase e in m_presence.Scene.Entities) + EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); + foreach (EntityBase e in entities) { if (e != null && e is SceneObjectGroup) m_pendingObjects.Enqueue((SceneObjectGroup)e); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index b6677f0..5494549 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization int primCount = 0; stream.WriteLine("\n"); - List EntityList = scene.GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = scene.GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public static void SavePrimsToXml2(Scene scene, string fileName) { - List EntityList = scene.GetEntities(); - - SavePrimListToXml2(EntityList, fileName); + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, fileName); } public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) { - List EntityList = scene.GetEntities(); - - SavePrimListToXml2(EntityList, stream, min, max); + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, stream, min, max); } public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) @@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", primName, scene.RegionInfo.RegionName, fileName); - List entityList = scene.GetEntities(); + EntityBase[] entityList = scene.GetEntities(); List primList = new List(); foreach (EntityBase ent in entityList) @@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - SavePrimListToXml2(primList, fileName); + SavePrimListToXml2(primList.ToArray(), fileName); } - public static void SavePrimListToXml2(List entityList, string fileName) + public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) { FileStream file = new FileStream(fileName, FileMode.Create); try @@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - public static void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max) + public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) { int primCount = 0; stream.WriteLine("\n"); -- cgit v1.1 From b597a295c489cef217b9dca6bd22df1340ca39ce Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 10 Sep 2010 12:41:36 -0700 Subject: Second pass at cleaning up thread safety in EntityManager and SceneGraph --- OpenSim/Region/Framework/Scenes/EntityManager.cs | 16 +----- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 66 +++++++++++----------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 11 +--- 3 files changed, 35 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index 85d0a4f..0defa93 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs @@ -34,7 +34,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes { - public class EntityManager //: IEnumerable + public class EntityManager { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly DoubleDictionary m_entities = new DoubleDictionary(); @@ -143,19 +143,5 @@ namespace OpenSim.Region.Framework.Scenes { return m_entities.TryGetValue(key, out obj); } - - /// - /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. - /// - /// - //public IEnumerator GetEnumerator() - //{ - // return GetEntities().GetEnumerator(); - //} - - //IEnumerator IEnumerable.GetEnumerator() - //{ - // return GetEnumerator(); - //} } } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3d3e822..f779a6d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -72,10 +72,7 @@ namespace OpenSim.Region.Framework.Scenes protected Dictionary m_scenePresenceMap = new Dictionary(); protected List m_scenePresenceArray = new List(); - // SceneObjects is not currently populated or used. - //public Dictionary SceneObjects; protected internal EntityManager Entities = new EntityManager(); -// protected internal Dictionary Entities = new Dictionary(); protected internal Dictionary RestorePresences = new Dictionary(); protected RegionInfo m_regInfo; @@ -351,28 +348,28 @@ namespace OpenSim.Region.Framework.Scenes if (Entities.ContainsKey(sceneObject.UUID)) return false; - // Clamp child prim sizes and add child prims to the m_numPrim count + List children; lock (sceneObject.Children) + children = new List(sceneObject.Children.Values); + + // Clamp child prim sizes and add child prims to the m_numPrim count + if (m_parentScene.m_clampPrimSize) { - if (m_parentScene.m_clampPrimSize) + foreach (SceneObjectPart part in children) { - foreach (SceneObjectPart part in sceneObject.Children.Values) - { - Vector3 scale = part.Shape.Scale; + Vector3 scale = part.Shape.Scale; - if (scale.X > m_parentScene.m_maxNonphys) - scale.X = m_parentScene.m_maxNonphys; - if (scale.Y > m_parentScene.m_maxNonphys) - scale.Y = m_parentScene.m_maxNonphys; - if (scale.Z > m_parentScene.m_maxNonphys) - scale.Z = m_parentScene.m_maxNonphys; + if (scale.X > m_parentScene.m_maxNonphys) + scale.X = m_parentScene.m_maxNonphys; + if (scale.Y > m_parentScene.m_maxNonphys) + scale.Y = m_parentScene.m_maxNonphys; + if (scale.Z > m_parentScene.m_maxNonphys) + scale.Z = m_parentScene.m_maxNonphys; - part.Shape.Scale = scale; - } + part.Shape.Scale = scale; } - - m_numPrim += sceneObject.Children.Count; } + m_numPrim += children.Count; sceneObject.AttachToScene(m_parentScene); @@ -390,14 +387,14 @@ namespace OpenSim.Region.Framework.Scenes lock (SceneObjectGroupsByFullID) { SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) + foreach (SceneObjectPart part in children) SceneObjectGroupsByFullID[part.UUID] = sceneObject; } lock (SceneObjectGroupsByLocalID) { SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) + foreach (SceneObjectPart part in children) SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; } @@ -859,13 +856,13 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; lock (SceneObjectGroupsByLocalID) + SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); + + if (sog != null) { - if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) - { - if (sog.HasChildPrim(localID)) - return sog; - SceneObjectGroupsByLocalID.Remove(localID); - } + if (sog.HasChildPrim(localID)) + return sog; + SceneObjectGroupsByLocalID.Remove(localID); } EntityBase[] entityList = GetEntities(); @@ -896,17 +893,18 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectGroup sog; lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); + + if (sog != null) { - if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) + lock (sog.Children) { - lock (sog.Children) - { - if (sog.Children.ContainsKey(fullID)) - return sog; - } - - SceneObjectGroupsByFullID.Remove(fullID); + if (sog.Children.ContainsKey(fullID)) + return sog; } + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Remove(fullID); } EntityBase[] entityList = GetEntities(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 09e3e0e..ba5e33c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2091,16 +2091,9 @@ namespace OpenSim.Region.Framework.Scenes /// null if a child part with the primID was not found public SceneObjectPart GetChildPart(UUID primID) { - SceneObjectPart childPart = null; - + SceneObjectPart childPart; lock (m_parts) - { - if (m_parts.ContainsKey(primID)) - { - childPart = m_parts[primID]; - } - } - + m_parts.TryGetValue(primID, out childPart); return childPart; } -- cgit v1.1 From 30306a775af74e1fe080590998a71a4c7e64ad12 Mon Sep 17 00:00:00 2001 From: randomhuman Date: Sun, 5 Sep 2010 21:44:46 +0100 Subject: Made it impossible to create a user with names containing spaces and prevented passwords from being echoed after enter is pressed. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7ce95a7..6fa78e0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1159,8 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { MainConsole.Instance.Output("The current estate has no owner set."); - string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); - string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); + List excluded = new List(new char[1]{' '}); + string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); + string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); -- cgit v1.1 From 109b51758398d24a96a16900e8feb24361aee29d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 20:43:06 -0700 Subject: Fixed the naming mess around data connectors for simulation data --- OpenSim/Region/Framework/Scenes/EventManager.cs | 4 ++-- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index c434e4f..6b2e03e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnTerrainTickDelegate OnTerrainTick; - public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); + public delegate void OnBackupDelegate(ISimulationDataStore datastore, bool forceBackup); public event OnBackupDelegate OnBackup; @@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnBackup(IRegionDataStore dstore, bool forced) + public void TriggerOnBackup(ISimulationDataStore dstore, bool forced) { OnBackupDelegate handlerOnAttach = OnBackup; if (handlerOnAttach != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ba5e33c..4024328 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes /// Processes backup. /// /// - public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) + public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup) { if (!m_isBackedUp) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 87c4860..1984d45 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes /// Process inventory backup /// /// - public void ProcessInventoryBackup(IRegionDataStore datastore) + public void ProcessInventoryBackup(ISimulationDataStore datastore) { if (HasInventoryChanged) { -- cgit v1.1 From 007912d6f4810192853c4aeee5f9834de748f2b2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 23:41:48 -0700 Subject: Shuffling fields and properties around in Scene to make Scene.cs more readable --- OpenSim/Region/Framework/Scenes/Scene.cs | 262 +++++++++++++++---------------- 1 file changed, 124 insertions(+), 138 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6fa78e0..46b84bb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes public partial class Scene : SceneBase { - public delegate void SynchronizeSceneHandler(Scene scene); - public SynchronizeSceneHandler SynchronizeScene = null; - - /* Used by the loadbalancer plugin on GForge */ - protected int m_splitRegionID = 0; - public int SplitRegionID - { - get { return m_splitRegionID; } - set { m_splitRegionID = value; } - } - private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; - #region Fields + public delegate void SynchronizeSceneHandler(Scene scene); - protected Timer m_restartWaitTimer = new Timer(); + #region Fields + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; - - protected List m_regionRestartNotifyList = new List(); - protected List m_neighbours = new List(); - - private volatile int m_bordersLocked = 0; - public bool BordersLocked - { - get { return m_bordersLocked == 1; } - set - { - if (value == true) - m_bordersLocked = 1; - else - m_bordersLocked = 0; - } - } public List NorthBorders = new List(); public List EastBorders = new List(); public List SouthBorders = new List(); public List WestBorders = new List(); - /// - /// The scene graph for this scene - /// - /// TODO: Possibly stop other classes being able to manipulate this directly. - private SceneGraph m_sceneGraph; - - /// - /// Are we applying physics to any of the prims in this scene? - /// + /// Are we applying physics to any of the prims in this scene? public bool m_physicalPrim; public float m_maxNonphys = 256; public float m_maxPhys = 10; @@ -119,24 +85,127 @@ namespace OpenSim.Region.Framework.Scenes // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; public int MaxUndoCount = 5; + public bool LoginsDisabled = true; + public bool LoadingPrims; + public IXfer XferManager; + + // the minimum time that must elapse before a changed object will be considered for persisted + public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; + // the maximum time that must elapse before a changed object will be considered for persisted + public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; + + protected int m_splitRegionID; + protected Timer m_restartWaitTimer = new Timer(); + protected List m_regionRestartNotifyList = new List(); + protected List m_neighbours = new List(); + protected string m_simulatorVersion = "OpenSimulator Server"; + protected ModuleLoader m_moduleLoader; + protected StorageManager m_storageManager; + protected AgentCircuitManager m_authenticateHandler; + protected SceneCommunicationService m_sceneGridService; + + protected IAssetService m_AssetService; + protected IAuthorizationService m_AuthorizationService; + protected IInventoryService m_InventoryService; + protected IGridService m_GridService; + protected ILibraryService m_LibraryService; + protected ISimulationService m_simulationService; + protected IAuthenticationService m_AuthenticationService; + protected IPresenceService m_PresenceService; + protected IUserAccountService m_UserAccountService; + protected IAvatarService m_AvatarService; + protected IGridUserService m_GridUserService; + + protected IXMLRPC m_xmlrpcModule; + protected IWorldComm m_worldCommModule; + protected IAvatarFactory m_AvatarFactory; + protected IConfigSource m_config; + protected IRegionSerialiserModule m_serialiser; + protected IDialogModule m_dialogModule; + protected IEntityTransferModule m_teleportModule; + protected ICapabilitiesModule m_capsModule; + // Central Update Loop + protected int m_fps = 10; + protected uint m_frame; + protected float m_timespan = 0.089f; + protected DateTime m_lastupdate = DateTime.UtcNow; + + // TODO: Possibly stop other classes being able to manipulate this directly. + private SceneGraph m_sceneGraph; + private volatile int m_bordersLocked; private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_incrementsof15seconds; private volatile bool m_backingup; - private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); + private Object m_heartbeatLock = new Object(); - protected string m_simulatorVersion = "OpenSimulator Server"; + private int m_update_physics = 1; + private int m_update_entitymovement = 1; + private int m_update_objects = 1; // Update objects which have scheduled themselves for updates + private int m_update_presences = 1; // Update scene presence movements + private int m_update_events = 1; + private int m_update_backup = 200; + private int m_update_terrain = 50; + private int m_update_land = 1; + private int m_update_coarse_locations = 50; - protected ModuleLoader m_moduleLoader; - protected StorageManager m_storageManager; - protected AgentCircuitManager m_authenticateHandler; + private int frameMS; + private int physicsMS2; + private int physicsMS; + private int otherMS; + private int tempOnRezMS; + private int eventMS; + private int backupMS; + private int terrainMS; + private int landMS; + private int lastCompletedFrame; - protected SceneCommunicationService m_sceneGridService; - public bool LoginsDisabled = true; - public bool LoadingPrims = false; + private bool m_physics_enabled = true; + private bool m_scripts_enabled = true; + private string m_defaultScriptEngine; + private int m_LastLogin; + private Thread HeartbeatThread; + private volatile bool shuttingdown; + + private int m_lastUpdate; + private bool m_firstHeartbeat = true; + private object m_deleting_scene_object = new object(); + + private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; + private bool m_reprioritizationEnabled = true; + private double m_reprioritizationInterval = 5000.0; + private double m_rootReprioritizationDistance = 10.0; + private double m_childReprioritizationDistance = 20.0; + + private Timer m_mapGenerationTimer = new Timer(); + private bool m_generateMaptiles; + + #endregion Fields + + #region Properties + + /* Used by the loadbalancer plugin on GForge */ + public int SplitRegionID + { + get { return m_splitRegionID; } + set { m_splitRegionID = value; } + } + + public bool BordersLocked + { + get { return m_bordersLocked == 1; } + set + { + if (value == true) + m_bordersLocked = 1; + else + m_bordersLocked = 0; + } + } + public new float TimeDilation { get { return m_sceneGraph.PhysicsScene.TimeDilation; } @@ -147,13 +216,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_sceneGridService; } } - public IXfer XferManager; - - protected IAssetService m_AssetService; - protected IAuthorizationService m_AuthorizationService; - - private Object m_heartbeatLock = new Object(); - public IAssetService AssetService { get @@ -191,8 +253,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IInventoryService m_InventoryService; - public IInventoryService InventoryService { get @@ -211,8 +271,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IGridService m_GridService; - public IGridService GridService { get @@ -231,8 +289,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected ILibraryService m_LibraryService; - public ILibraryService LibraryService { get @@ -244,7 +300,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected ISimulationService m_simulationService; public ISimulationService SimulationService { get @@ -255,7 +310,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IAuthenticationService m_AuthenticationService; public IAuthenticationService AuthenticationService { get @@ -266,7 +320,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IPresenceService m_PresenceService; public IPresenceService PresenceService { get @@ -276,7 +329,7 @@ namespace OpenSim.Region.Framework.Scenes return m_PresenceService; } } - protected IUserAccountService m_UserAccountService; + public IUserAccountService UserAccountService { get @@ -287,8 +340,7 @@ namespace OpenSim.Region.Framework.Scenes } } - protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; - public OpenSim.Services.Interfaces.IAvatarService AvatarService + public IAvatarService AvatarService { get { @@ -298,7 +350,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IGridUserService m_GridUserService; public IGridUserService GridUserService { get @@ -309,58 +360,18 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IXMLRPC m_xmlrpcModule; - protected IWorldComm m_worldCommModule; public IAttachmentsModule AttachmentsModule { get; set; } - protected IAvatarFactory m_AvatarFactory; + public IAvatarFactory AvatarFactory { get { return m_AvatarFactory; } } - protected IConfigSource m_config; - protected IRegionSerialiserModule m_serialiser; - protected IDialogModule m_dialogModule; - protected IEntityTransferModule m_teleportModule; - protected ICapabilitiesModule m_capsModule; public ICapabilitiesModule CapsModule { get { return m_capsModule; } } - protected override IConfigSource GetConfig() - { - return m_config; - } - - // Central Update Loop - - protected int m_fps = 10; - protected uint m_frame; - protected float m_timespan = 0.089f; - protected DateTime m_lastupdate = DateTime.UtcNow; - - private int m_update_physics = 1; - private int m_update_entitymovement = 1; - private int m_update_objects = 1; // Update objects which have scheduled themselves for updates - private int m_update_presences = 1; // Update scene presence movements - private int m_update_events = 1; - private int m_update_backup = 200; - private int m_update_terrain = 50; - private int m_update_land = 1; - private int m_update_coarse_locations = 50; - - private int frameMS; - private int physicsMS2; - private int physicsMS; - private int otherMS; - private int tempOnRezMS; - private int eventMS; - private int backupMS; - private int terrainMS; - private int landMS; - private int lastCompletedFrame; - public int MonitorFrameTime { get { return frameMS; } } public int MonitorPhysicsUpdateTime { get { return physicsMS; } } public int MonitorPhysicsSyncTime { get { return physicsMS2; } } @@ -372,36 +383,6 @@ namespace OpenSim.Region.Framework.Scenes public int MonitorLandTime { get { return landMS; } } public int MonitorLastFrameTick { get { return lastCompletedFrame; } } - private bool m_physics_enabled = true; - private bool m_scripts_enabled = true; - private string m_defaultScriptEngine; - private int m_LastLogin; - private Thread HeartbeatThread; - private volatile bool shuttingdown; - - private int m_lastUpdate; - private bool m_firstHeartbeat = true; - - private object m_deleting_scene_object = new object(); - - // the minimum time that must elapse before a changed object will be considered for persisted - public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; - // the maximum time that must elapse before a changed object will be considered for persisted - public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; - - private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; - private bool m_reprioritizationEnabled = true; - private double m_reprioritizationInterval = 5000.0; - private double m_rootReprioritizationDistance = 10.0; - private double m_childReprioritizationDistance = 20.0; - - private Timer m_mapGenerationTimer = new Timer(); - bool m_generateMaptiles = false; - - #endregion - - #region Properties - public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } @@ -481,7 +462,7 @@ namespace OpenSim.Region.Framework.Scenes set { m_sceneGraph.RestorePresences = value; } } - #endregion + #endregion Properties #region Constructors @@ -3954,6 +3935,11 @@ namespace OpenSim.Region.Framework.Scenes #region Other Methods + protected override IConfigSource GetConfig() + { + return m_config; + } + #endregion public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) -- cgit v1.1 From 20cd1da6bf6118352af1f1f206bcd2303f098d6d Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 12 Sep 2010 12:54:31 -0400 Subject: Add copyright headers. --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 272f718..581b11c 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -1,3 +1,30 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + using System; using System.Collections.Generic; using log4net; -- cgit v1.1 From f1f0bc23f4501ba99035283d3407ddad2b21b785 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 12 Sep 2010 13:43:49 -0400 Subject: Formatting cleanup. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 12 ++++++------ OpenSim/Region/Framework/Scenes/Prioritizer.cs | 10 +++++----- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 ++++++------ .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- .../Region/Framework/Scenes/Scene.Permissions.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +++++++++--------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 +++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 18 +++++++++--------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 +++++++++++----------- .../Framework/Scenes/SceneObjectPartInventory.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 4 ++-- .../Framework/Scenes/Tests/SceneGraphTests.cs | 4 ++-- .../Scenes/Tests/SceneObjectLinkingTests.cs | 18 +++++++++--------- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 14 +++++++------- 16 files changed, 74 insertions(+), 74 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 6b2e03e..ff4595e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -332,7 +332,7 @@ namespace OpenSim.Region.Framework.Scenes /// If the object is being attached, then the avatarID will be present. If the object is being detached then /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); - public event Attach OnAttach; + public event Attach OnAttach; /// /// Called immediately after an object is loaded from storage. @@ -344,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes /// Called immediately before an object is saved to storage. /// /// - /// The scene object being persisted. + /// The scene object being persisted. /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. /// /// @@ -363,7 +363,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); public delegate void RegionUp(GridRegion region); - public event RegionUp OnRegionUp; + public event RegionUp OnRegionUp; public class MoneyTransferArgs : EventArgs { @@ -2063,7 +2063,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) { @@ -2105,7 +2105,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int local_id, IClientAPI remote_client) @@ -2127,6 +2127,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } } } diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 581b11c..19f8180 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the - /// viewer before child prim updates. + /// viewer before child prim updates. /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up /// being double. We do it both ways so that there is a still a priority delta even if the priority is already /// double.MinValue or double.MaxValue. @@ -150,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes if (entity is SceneObjectPart) { // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered + // before its scheduled update was triggered //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; } else { @@ -177,11 +177,11 @@ namespace OpenSim.Region.Framework.Scenes // Use group position for child prims Vector3 entityPos = entity.AbsolutePosition; if (entity is SceneObjectPart) - { + { // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene // before its scheduled update was triggered //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; } else { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a439eb9..838c648 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -145,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes item.Owner, item.Name, item.ID); return false; - } + } } /// @@ -253,7 +253,7 @@ namespace OpenSim.Region.Framework.Scenes // Update item with new asset item.AssetID = asset.FullID; if (group.UpdateInventoryItem(item)) - remoteClient.SendAgentAlertMessage("Script saved", false); + remoteClient.SendAgentAlertMessage("Script saved", false); part.GetProperties(remoteClient); @@ -1975,7 +1975,7 @@ namespace OpenSim.Region.Framework.Scenes return null; if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) - return null; + return null; if (!Permissions.BypassPermissions()) { @@ -2053,7 +2053,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart child in partList) child.Inventory.ChangeInventoryOwner(ownerID); @@ -2068,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart child in partList) { @@ -2078,7 +2078,7 @@ namespace OpenSim.Region.Framework.Scenes sog.SetOwnerId(groupID); sog.ApplyNextOwnerPermissions(); - } + } } foreach (uint localID in localIDs) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2f69476..7788e43 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart part in partList) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 4e80bf2..06890a0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes } } return true; - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 46b84bb..f8877e4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1916,7 +1916,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.ScheduleGroupForFullUpdate(); return sceneObject; - } + } /// /// Add an object into the scene that has come from storage @@ -2009,7 +2009,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) - { + { return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); } @@ -2102,12 +2102,12 @@ namespace OpenSim.Region.Framework.Scenes // group has recently been delinked from another group but that this change has not been persisted // to the DB. ForceSceneObjectBackup(so); - so.DetachFromBackup(); + so.DetachFromBackup(); m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); } // We need to keep track of this state in case this group is still queued for further backup. - so.IsDeleted = true; + so.IsDeleted = true; return true; } @@ -2394,7 +2394,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = GetScenePresence(userID); if (sp != null && AttachmentsModule != null) { - uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); + uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); } @@ -2437,7 +2437,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.RootPart.AddFlag(PrimFlags.Phantom); // Don't sent a full update here because this will cause full updates to be sent twice for - // attachments on region crossings, resulting in viewer glitches. + // attachments on region crossings, resulting in viewer glitches. AddRestoredSceneObject(sceneObject, false, false, false); // Handle attachment special case @@ -2681,7 +2681,7 @@ namespace OpenSim.Region.Framework.Scenes } public virtual void SubscribeToClientPrimEvents(IClientAPI client) - { + { client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; @@ -2717,7 +2717,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; - client.OnObjectDrop += m_sceneGraph.DropObject; + client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; } @@ -3669,7 +3669,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { ScenePresence presence = GetScenePresence(agentID); - if(presence != null) + if (presence != null) { try { diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f8591ba..c71aefa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - /// + /// public void AddCommand( object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f779a6d..5ac8ff5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -298,7 +298,7 @@ namespace OpenSim.Region.Framework.Scenes /// Position of the object /// Rotation of the object /// Velocity of the object. This parameter only has an effect if the object is physical - /// + /// public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) { @@ -322,7 +322,7 @@ namespace OpenSim.Region.Framework.Scenes } return true; - } + } /// /// Add an object to the scene. This will both update the scene, and send information about the @@ -1284,7 +1284,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) - { + { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { if (m_parentScene.AttachmentsModule != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4024328..4caa439 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -677,7 +677,7 @@ namespace OpenSim.Region.Framework.Scenes minY = 256f; minZ = 8192f; - lock(m_parts) + lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) { @@ -1005,7 +1005,7 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = detachedpos; m_rootPart.AttachedAvatar = UUID.Zero; - //Anakin Lohner bug #3839 + //Anakin Lohner bug #3839 lock (m_parts) { foreach (SceneObjectPart p in m_parts.Values) @@ -1226,7 +1226,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Delete this group from its scene. + /// Delete this group from its scene. /// /// /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood @@ -1383,7 +1383,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_isBackedUp) { // m_log.DebugFormat( -// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); +// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); return; } @@ -1395,7 +1395,7 @@ namespace OpenSim.Region.Framework.Scenes } // Since this is the top of the section of call stack for backing up a particular scene object, don't let - // any exception propogate upwards. + // any exception propogate upwards. try { if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart @@ -1546,7 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes newPart.LinkNum = part.LinkNum; } - // Need to duplicate the physics actor as well + // Need to duplicate the physics actor as well if (part.PhysActor != null && userExposed) { PrimitiveBaseShape pbs = part.Shape; @@ -1562,7 +1562,7 @@ namespace OpenSim.Region.Framework.Scenes part.PhysActor.LocalID = part.LocalId; part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); - } + } } if (userExposed) @@ -1838,7 +1838,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart newPart = null; lock (m_parts) - { + { newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); newPart.SetParent(this); m_parts.Add(newPart.UUID, newPart); @@ -2337,7 +2337,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.LinkNum > linkPart.LinkNum) p.LinkNum--; } - } + } } linkPart.ParentID = 0; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3753dcb..024bdc9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1010,12 +1010,12 @@ namespace OpenSim.Region.Framework.Scenes return m_mediaUrl; } - set - { + set + { m_mediaUrl = value; if (ParentGroup != null) - ParentGroup.HasGroupChanged = true; + ParentGroup.HasGroupChanged = true; } } @@ -1028,7 +1028,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); m_createSelected = value; } - } + } #endregion @@ -1189,7 +1189,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Property flags. See OpenMetaverse.PrimFlags - /// + /// /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge public PrimFlags Flags { @@ -1355,7 +1355,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Tell the scene presence that it should send updates for this part to its client - /// + /// public void AddFullUpdateToAvatar(ScenePresence presence) { presence.SceneViewer.QueuePartForUpdate(this); @@ -1414,7 +1414,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - if(!sp.IsChildAgent) + if (!sp.IsChildAgent) sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); }); } @@ -1659,7 +1659,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); - return dupe; + return dupe; } protected void AssetReceived(string id, Object sender, AssetBase asset) @@ -1969,10 +1969,10 @@ namespace OpenSim.Region.Framework.Scenes } public uint GetEffectiveObjectFlags() - { + { // Commenting this section of code out since it doesn't actually do anything, as enums are handled by // value rather than reference -// PrimFlags f = _flags; +// PrimFlags f = _flags; // if (m_parentGroup == null || m_parentGroup.RootPart == this) // f &= ~(PrimFlags.Touch | PrimFlags.Money); @@ -4733,7 +4733,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.IsDeleted) return; - if (IsAttachment && ParentGroup.RootPart != this) + if (IsAttachment && ParentGroup.RootPart != this) return; // Causes this thread to dig into the Client Thread Data. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1984d45..4affdef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1094,7 +1094,7 @@ namespace OpenSim.Region.Framework.Scenes item.OwnerChanged = false; engine.ResumeScript(item.ItemID); } - } + } } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cc9355e..177cf1e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1287,7 +1287,7 @@ namespace OpenSim.Region.Framework.Scenes // Setting parent ID would fix this, if we knew what value // to use. Or we could add a m_isSitting variable. //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); - SitGround = true; + SitGround = true; } // In the future, these values might need to go global. diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 7aa5a93..b45291f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes { m_pendingObjects = new Queue(); - lock(m_pendingObjects) + lock (m_pendingObjects) { EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); foreach (EntityBase e in entities) @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes } } - lock(m_pendingObjects) + lock (m_pendingObjects) { while (m_pendingObjects != null && m_pendingObjects.Count > 0) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index c9662ef..7d9a6a9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); - SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); + SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); @@ -84,6 +84,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupePart1.PhysActor, Is.Not.Null); Assert.That(dupePart2.PhysActor, Is.Not.Null); */ - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e3ef263..9f787c9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneSetupHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -282,11 +282,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = linkPartName, UUID = linkPartUuid }; + { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); - sog.AddPart(linkPart); - scene.AddNewSceneObject(sog, true); + sog.AddPart(linkPart); + scene.AddNewSceneObject(sog, true); // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. @@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneSetupHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -321,11 +321,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = linkPartName, UUID = linkPartUuid }; + { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); - sog.AddPart(linkPart); - scene.AddNewSceneObject(sog, true); + sog.AddPart(linkPart); + scene.AddNewSceneObject(sog, true); // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. @@ -333,7 +333,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // These changes should occur immediately without waiting for a backup pass SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); - scene.DeleteSceneObject(groupToDelete, false); + scene.DeleteSceneObject(groupToDelete, false); List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 5e491c2..fe59d4f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; string userPassword = "troll"; - UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); + UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); + return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); } protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) @@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Tests SceneObjectPart part1 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = part1Name, UUID = part1Id }; - return new SceneObjectGroup(part1); + return new SceneObjectGroup(part1); } protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) @@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Tests nc.BodyText = "Hello World!"; nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); - UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); + UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); scene.AssetService.Store(ncAsset); @@ -114,9 +114,9 @@ namespace OpenSim.Region.Framework.Tests scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem - = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); - } + } /// /// Test MoveTaskInventoryItem where the item has no parent folder assigned. @@ -138,7 +138,7 @@ namespace OpenSim.Region.Framework.Tests scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem - = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); } } -- cgit v1.1 From 0db1ed0b5a6f5bd104c6008f142d173c84263ce5 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 12 Sep 2010 14:20:26 -0700 Subject: * Added ISimulationDataService and IEstateDataService * Removed StorageManager * CONFIG CHANGE: There are no more database settings in OpenSim.ini. Check the config-include configuration files for region store and estate store database settings --- OpenSim/Region/Framework/Scenes/EventManager.cs | 4 +- OpenSim/Region/Framework/Scenes/Scene.cs | 102 ++++++++++++++------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 2 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 4 +- 5 files changed, 77 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 6b2e03e..72b8de8 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnTerrainTickDelegate OnTerrainTick; - public delegate void OnBackupDelegate(ISimulationDataStore datastore, bool forceBackup); + public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); public event OnBackupDelegate OnBackup; @@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnBackup(ISimulationDataStore dstore, bool forced) + public void TriggerOnBackup(ISimulationDataService dstore, bool forced) { OnBackupDelegate handlerOnAttach = OnBackup; if (handlerOnAttach != null) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 46b84bb..9a9ef5f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -100,10 +100,11 @@ namespace OpenSim.Region.Framework.Scenes protected List m_neighbours = new List(); protected string m_simulatorVersion = "OpenSimulator Server"; protected ModuleLoader m_moduleLoader; - protected StorageManager m_storageManager; protected AgentCircuitManager m_authenticateHandler; protected SceneCommunicationService m_sceneGridService; + protected ISimulationDataService m_SimulationDataService; + protected IEstateDataService m_EstateDataService; protected IAssetService m_AssetService; protected IAuthorizationService m_AuthorizationService; protected IInventoryService m_InventoryService; @@ -216,6 +217,42 @@ namespace OpenSim.Region.Framework.Scenes get { return m_sceneGridService; } } + public ISimulationDataService SimulationDataService + { + get + { + if (m_SimulationDataService == null) + { + m_SimulationDataService = RequestModuleInterface(); + + if (m_SimulationDataService == null) + { + throw new Exception("No ISimulationDataService available."); + } + } + + return m_SimulationDataService; + } + } + + public IEstateDataService EstateDataService + { + get + { + if (m_EstateDataService == null) + { + m_EstateDataService = RequestModuleInterface(); + + if (m_EstateDataService == null) + { + throw new Exception("No IEstateDataService available."); + } + } + + return m_EstateDataService; + } + } + public IAssetService AssetService { get @@ -468,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, - StorageManager storeManager, + ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { @@ -504,7 +541,8 @@ namespace OpenSim.Region.Framework.Scenes m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; - m_storageManager = storeManager; + m_SimulationDataService = simDataService; + m_EstateDataService = estateDataService; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -523,11 +561,9 @@ namespace OpenSim.Region.Framework.Scenes #region Region Settings // Load region settings - m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); - if (m_storageManager.EstateDataStore != null) - { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - } + m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); + if (estateDataService != null) + m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); #endregion Region Settings @@ -537,9 +573,9 @@ namespace OpenSim.Region.Framework.Scenes //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += - new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); + new EventManager.LandObjectAdded(simDataService.StoreLandObject); EventManager.OnLandObjectRemoved += - new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); + new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); m_sceneGraph = new SceneGraph(this, m_regInfo); @@ -1085,7 +1121,7 @@ namespace OpenSim.Region.Framework.Scenes { if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) { - ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); + ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false); } } @@ -1526,7 +1562,7 @@ namespace OpenSim.Region.Framework.Scenes { lock (m_returns) { - EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); + EventManager.TriggerOnBackup(SimulationDataService, forced); m_backingup = false; foreach (KeyValuePair ret in m_returns) @@ -1567,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes { if (group != null) { - group.ProcessBackup(m_storageManager.DataStore, true); + group.ProcessBackup(SimulationDataService, true); } } @@ -1609,19 +1645,19 @@ namespace OpenSim.Region.Framework.Scenes /// public void SaveTerrain() { - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } public void StoreWindlightProfile(RegionLightShareData wl) { m_regInfo.WindlightSettings = wl; - m_storageManager.DataStore.StoreRegionWindlightSettings(wl); + SimulationDataService.StoreRegionWindlightSettings(wl); m_eventManager.TriggerOnSaveNewWindlightProfile(); } public void LoadWindlightProfile() { - m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); + m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID); m_eventManager.TriggerOnSaveNewWindlightProfile(); } @@ -1632,13 +1668,13 @@ namespace OpenSim.Region.Framework.Scenes { try { - double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); + double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); if (map == null) { m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); Heightmap = new TerrainChannel(); - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } else { @@ -1655,7 +1691,7 @@ namespace OpenSim.Region.Framework.Scenes { Heightmap = new TerrainChannel(); - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } } catch (Exception e) @@ -1702,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes public void loadAllLandObjectsFromStorage(UUID regionID) { m_log.Info("[SCENE]: Loading land objects from storage"); - List landData = m_storageManager.DataStore.LoadLandObjects(regionID); + List landData = SimulationDataService.LoadLandObjects(regionID); if (LandChannel != null) { @@ -1733,7 +1769,7 @@ namespace OpenSim.Region.Framework.Scenes LoadingPrims = true; m_log.Info("[SCENE]: Loading objects from datastore"); - List PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); + List PrimsFromDB = SimulationDataService.LoadObjects(regionID); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); @@ -2102,12 +2138,12 @@ namespace OpenSim.Region.Framework.Scenes // group has recently been delinked from another group but that this change has not been persisted // to the DB. ForceSceneObjectBackup(so); - so.DetachFromBackup(); - m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); + so.DetachFromBackup(); + SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); } // We need to keep track of this state in case this group is still queued for further backup. - so.IsDeleted = true; + so.IsDeleted = true; return true; } @@ -4408,7 +4444,7 @@ namespace OpenSim.Region.Framework.Scenes public void DeleteFromStorage(UUID uuid) { - m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); + SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); } public int GetHealth() @@ -4817,17 +4853,21 @@ namespace OpenSim.Region.Framework.Scenes public List GetEstateRegions(int estateID) { - if (m_storageManager.EstateDataStore == null) - return new List(); + IEstateDataService estateDataService = EstateDataService; + if (estateDataService == null) + return new List(0); - return m_storageManager.EstateDataStore.GetRegions(estateID); + return estateDataService.GetRegions(estateID); } public void ReloadEstateData() { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - - TriggerEstateSunUpdate(); + IEstateDataService estateDataService = EstateDataService; + if (estateDataService != null) + { + m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); + TriggerEstateSunUpdate(); + } } public void TriggerEstateSunUpdate() diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4024328..454f031 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes /// Processes backup. /// /// - public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup) + public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) { if (!m_isBackedUp) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1984d45..e45d488 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes /// Process inventory backup /// /// - public void ProcessInventoryBackup(ISimulationDataStore datastore) + public void ProcessInventoryBackup(ISimulationDataService datastore) { if (HasInventoryChanged) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e3ef263..d634840 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -292,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // scene backup thread. scene.Backup(true); - List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); @@ -335,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); scene.DeleteSceneObject(groupToDelete, false); - List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); -- cgit v1.1