From b290ce405f01ae4b52ba5d5ec1661a2ae44ba2d6 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 21 Jun 2008 19:56:19 +0000 Subject: * Remove a bug I created in r5171 where taking an object would terminate the client session * change code to use an explicit state variable instead of using SOG.Name = null to signal deletion --- .../Modules/World/Archiver/ArchiveReadRequest.cs | 15 +++++++++++++++ .../Modules/World/Serialiser/SceneXmlLoader.cs | 1 + OpenSim/Region/Environment/Scenes/EntityBase.cs | 9 +++++++++ OpenSim/Region/Environment/Scenes/InnerScene.cs | 8 +++++--- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +--------- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 11 +++++++++-- 6 files changed, 40 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 6e53f28..d2b8018 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -31,6 +31,7 @@ using OpenSim.Region.Environment.Modules.World.Serialiser; using System; using System.IO; using System.Reflection; +using System.Xml; using libsecondlife; using log4net; @@ -101,6 +102,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Loading prim data"); IRegionSerialiser serialiser = m_scene.RequestModuleInterface(); + + // Temporary code to read each sog in the file separately, pending actually having these in separate files +// XmlTextReader xtr = new XmlTextReader(new StringReader(serializedPrims)); +// XmlDocument doc = new XmlDocument(); +// reader.WhitespaceHandling = WhitespaceHandling.None; +// doc.Load(xtr); +// xtr.Close(); +// XmlNode sceneNode = doc.FirstChild; +// +// foreach (XmlNode objectNode in sceneNode.ChildNodes) +// { +// CreatePrimFromXml2(m_scene, objectNode.OuterXml); +// } + serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); } } diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index db16601..94161f0 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs @@ -114,6 +114,7 @@ namespace OpenSim.Region.Environment.Scenes doc.Load(reader); reader.Close(); rootNode = doc.FirstChild; + foreach (XmlNode aPrimNode in rootNode.ChildNodes) { CreatePrimFromXml2(scene, aPrimNode.OuterXml); diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 1970896..bc3e06c 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -63,6 +63,15 @@ namespace OpenSim.Region.Environment.Scenes get { return m_name; } set { m_name = value; } } + + /// + /// Signals whether this group was in a scene but has since been deleted from it. + /// + public bool IsDeleted + { + get { return m_isDeleted; } + } + protected bool m_isDeleted; protected LLVector3 m_pos; diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index e803122..7529d77 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -293,21 +293,23 @@ namespace OpenSim.Region.Environment.Scenes // Don't abort the whole update if one entity happens to give us an exception. try { - // A null name signals that this group was deleted before the scheduled update + // Check that the group was not deleted before the scheduled update // FIXME: This is merely a temporary measure to reduce the incidence of failure, when // an object has been deleted from a scene before update was processed. // A more fundamental overhaul of the update mechanism is required to eliminate all // the race conditions. - if (entity.Name != null) + if (!entity.IsDeleted) { m_updateList[i].Update(); } } catch (Exception e) { - m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e);//entity.m_uuid + m_log.ErrorFormat( + "[INNER SCENE]: Failed to update {0}, {1} - {2}", entity.Name, entity.UUID, e); } } + m_updateList.Clear(); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 73b3a49..aa74072 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1665,7 +1665,7 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// Delete this object from the scene. + /// Delete the given object from the scene. /// /// public void DeleteSceneObject(SceneObjectGroup group) @@ -1686,14 +1686,6 @@ namespace OpenSim.Region.Environment.Scenes group.DeleteGroup(); group.DeleteParts(); - - // In case anybody else retains a reference to this group, signal deletion by changing the name - // to null. We can't zero out the UUID because this is taken from the root part, which has already - // been removed. - // FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race - // conditions where a user deletes an entity while it is being stored. Really, the update - // code needs a redesign. - group.Name = null; } /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 0d759cf..814db05 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes { get { return RootPart.Name; } set { RootPart.Name = value; } - } + } /// /// Added because the Parcel code seems to use it @@ -921,10 +921,16 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// Completely delete this group and tell all the scene presences about that deletion. + /// Delete this group from its scene and tell all the scene presences about that deletion. /// public void DeleteGroup() { + // We need to keep track of this state in case this group is still queued for backup. + // FIXME: This is a poor temporary solution, since it still leaves plenty of scope for race + // conditions where a user deletes an entity while it is being stored. Really, the update + // code needs a redesign. + m_isDeleted = true; + DetachFromBackup(this); lock (m_parts) @@ -944,6 +950,7 @@ namespace OpenSim.Region.Environment.Scenes } } } + public void FakeDeleteGroup() { foreach (SceneObjectPart part in m_parts.Values) -- cgit v1.1