From 52dd547863c0cdd22f53f0efcaef11ae096855a0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 11:31:52 +0200 Subject: Make SendKillObject send multiple localIDs in one packet. This avoids the halting visual behavior of large group deletes and eliminates the packet flood --- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 7 ++++++ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 8 ++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 26 +++++++++++++--------- .../Framework/Scenes/SceneCommunicationService.cs | 4 ---- .../Region/Framework/Scenes/SceneObjectGroup.cs | 6 +---- 5 files changed, 29 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 8feb022..a8d24fd 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -104,8 +104,15 @@ namespace OpenSim.Region.Framework.Scenes // better than losing the object for now. if (permissionToDelete) { + List killIDs = new List(); + foreach (SceneObjectGroup g in objectGroups) + { + killIDs.Add(g.LocalId); g.DeleteGroupFromScene(false); + } + + m_scene.SendKillObject(killIDs); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 8b5316a..6d7f984 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) { //Client still thinks the object exists, kill it - SendKillObject(localID); + deleteIDs.Add(localID); continue; } @@ -1717,7 +1717,7 @@ namespace OpenSim.Region.Framework.Scenes if (part.ParentGroup == null || part.ParentGroup.IsDeleted) { //Client still thinks the object exists, kill it - SendKillObject(localID); + deleteIDs.Add(localID); continue; } @@ -1727,8 +1727,8 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup grp = part.ParentGroup; - deleteIDs.Add(localID); deleteGroups.Add(grp); + deleteIDs.Add(grp.LocalId); if (remoteClient == null) { @@ -1811,6 +1811,8 @@ namespace OpenSim.Region.Framework.Scenes } } + SendKillObject(deleteIDs); + if (permissionToTake) { m_asyncSceneObjectDeleter.DeleteToInventory( diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 76e160d..48ae4ca 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2188,6 +2188,8 @@ namespace OpenSim.Region.Framework.Scenes } group.DeleteGroupFromScene(silent); + if (!silent) + SendKillObject(new List() { group.LocalId }); // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); } @@ -3273,7 +3275,7 @@ namespace OpenSim.Region.Framework.Scenes delegate(IClientAPI client) { //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway - try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } + try { client.SendKillObject(avatar.RegionHandle, new List() { avatar.LocalId}); } catch (NullReferenceException) { } }); @@ -3336,18 +3338,24 @@ namespace OpenSim.Region.Framework.Scenes #region Entities - public void SendKillObject(uint localID) + public void SendKillObject(List localIDs) { - SceneObjectPart part = GetSceneObjectPart(localID); - if (part != null) // It is a prim + List deleteIDs = new List(); + + foreach (uint localID in localIDs) { - if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid + SceneObjectPart part = GetSceneObjectPart(localID); + if (part != null) // It is a prim { - if (part.ParentGroup.RootPart != part) // Child part - return; + if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid + { + if (part.ParentGroup.RootPart != part) // Child part + continue; + } } + deleteIDs.Add(localID); } - ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); + ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); } #endregion @@ -3365,7 +3373,6 @@ namespace OpenSim.Region.Framework.Scenes //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; - m_sceneGridService.KiPrimitive += SendKillObject; m_sceneGridService.OnGetLandData += GetLandData; } @@ -3374,7 +3381,6 @@ namespace OpenSim.Region.Framework.Scenes /// public void UnRegisterRegionWithComms() { - m_sceneGridService.KiPrimitive -= SendKillObject; m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 1293d5d..632646d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -44,8 +44,6 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.Framework.Scenes { - public delegate void KiPrimitiveDelegate(uint localID); - public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List regionlst); /// @@ -113,8 +111,6 @@ namespace OpenSim.Region.Framework.Scenes // private LogOffUser handlerLogOffUser = null; // private GetLandData handlerGetLandData = null; // OnGetLandData - public KiPrimitiveDelegate KiPrimitive; - public SceneCommunicationService() { } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9a7d560..c870797 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1151,7 +1151,7 @@ namespace OpenSim.Region.Framework.Scenes // if (IsSelected) { - m_scene.SendKillObject(m_rootPart.LocalId); + m_scene.SendKillObject(new List { m_rootPart.LocalId }); } IsSelected = false; // fudge.... @@ -1415,11 +1415,7 @@ namespace OpenSim.Region.Framework.Scenes avatar.StandUp(); if (!silent) - { part.UpdateFlag = 0; - if (part == m_rootPart) - avatar.ControllingClient.SendKillObject(m_regionHandle, part.LocalId); - } }); } -- cgit v1.1