From 25fa6ee699cb7c08d2820af3d6f4da0d34f5dc00 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 7 May 2012 18:27:33 +0100 Subject: [PATCH] refactor: Instead of performing a ScenePresence lookup twice over LocateClientObject() and GetClientScene(), do the lookup just once in LocateClientObject() --- .../Avatar/Friends/FriendsModule.cs | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index b98e9fb3f6..c31e94b762 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -448,30 +448,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends /// Find the client for a ID /// public IClientAPI LocateClientObject(UUID agentID) - { - Scene scene = GetClientScene(agentID); - if (scene != null) - { - ScenePresence presence = scene.GetScenePresence(agentID); - if (presence != null) - return presence.ControllingClient; - } - - return null; - } - - /// - /// Find the scene for an agent - /// - private Scene GetClientScene(UUID agentId) { lock (m_Scenes) { foreach (Scene scene in m_Scenes) { - ScenePresence presence = scene.GetScenePresence(agentId); + ScenePresence presence = scene.GetScenePresence(agentID); if (presence != null && !presence.IsChildAgent) - return scene; + return presence.ControllingClient; } }