From 859bc717a4fe4cd5810ad9889cfb9b1e7f5c2046 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 19 Mar 2010 05:51:16 -0700 Subject: Cleaned up access to scenepresences in scenegraph. GetScenePresences and GetAvatars have been removed to consolidate locking and iteration within SceneGraph. All callers which used these to then iterate over presences have been refactored to instead pass their delegates to Scene.ForEachScenePresence(Action). --- .../World/Estate/EstateManagementModule.cs | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 464d922..91d40ab 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -468,26 +468,20 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) { - // Get a fresh list that will not change as people get teleported away - List presences = m_scene.GetScenePresences(); - - foreach(ScenePresence p in presences) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - if (p.UUID != senderID) + if (sp.UUID != senderID) { + ScenePresence p = m_scene.GetScenePresence(sp.UUID); // make sure they are still there, we could be working down a long list - ScenePresence s = m_scene.GetScenePresence(p.UUID); - if (s != null) + // Also make sure they are actually in the region + if (p != null && !p.IsChildAgent) { - // Also make sure they are actually in the region - if (!s.IsChildAgent) - { - s.ControllingClient.SendTeleportLocationStart(); - m_scene.TeleportClientHome(s.UUID, s.ControllingClient); - } + p.ControllingClient.SendTeleportLocationStart(); + m_scene.TeleportClientHome(p.UUID, p.ControllingClient); } } - } + }); } private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) { @@ -765,12 +759,11 @@ namespace OpenSim.Region.CoreModules.World.Estate public void sendRegionInfoPacketToAll() { - List avatars = m_scene.GetAvatars(); - - for (int i = 0; i < avatars.Count; i++) + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { - HandleRegionInfoRequest(avatars[i].ControllingClient); - } + if (!sp.IsChildAgent) + HandleRegionInfoRequest(sp.ControllingClient); + }); } public void sendRegionHandshake(IClientAPI remoteClient) -- cgit v1.1