refactor: Instead of performing a ScenePresence lookup twice over LocateClientObject() and GetClientScene(), do the lookup just once in LocateClientObject()
parent
cdf97ab3a6
commit
5053506d88
|
@ -448,30 +448,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
/// Find the client for a ID
|
/// Find the client for a ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IClientAPI LocateClientObject(UUID agentID)
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Find the scene for an agent
|
|
||||||
/// </summary>
|
|
||||||
private Scene GetClientScene(UUID agentId)
|
|
||||||
{
|
{
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
{
|
{
|
||||||
foreach (Scene scene in m_Scenes)
|
foreach (Scene scene in m_Scenes)
|
||||||
{
|
{
|
||||||
ScenePresence presence = scene.GetScenePresence(agentId);
|
ScenePresence presence = scene.GetScenePresence(agentID);
|
||||||
if (presence != null && !presence.IsChildAgent)
|
if (presence != null && !presence.IsChildAgent)
|
||||||
return scene;
|
return presence.ControllingClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue