mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
Rewrote parts of the code that were double-locking different objects. This is about half of the code base reviewed.
This commit is contained in:
@@ -442,42 +442,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
private ScenePresence GetRootPresenceFromAgentID(UUID AgentID)
|
||||
{
|
||||
ScenePresence returnAgent = null;
|
||||
List<Scene> scenes = null;
|
||||
lock (m_scenes)
|
||||
{
|
||||
ScenePresence queryagent = null;
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
queryagent = scene.GetScenePresence(AgentID);
|
||||
if (queryagent != null)
|
||||
{
|
||||
if (!queryagent.IsChildAgent)
|
||||
{
|
||||
returnAgent = queryagent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnAgent;
|
||||
}
|
||||
scenes = new List<Scene>(m_scenes.Values);
|
||||
|
||||
private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID)
|
||||
{
|
||||
ScenePresence returnAgent = null;
|
||||
lock (m_scenes)
|
||||
ScenePresence queryagent = null;
|
||||
foreach (Scene scene in scenes)
|
||||
{
|
||||
ScenePresence queryagent = null;
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
queryagent = scene.GetScenePresence(AgentID);
|
||||
if (queryagent != null)
|
||||
{
|
||||
queryagent = scene.GetScenePresence(AgentID);
|
||||
if (queryagent != null)
|
||||
if (!queryagent.IsChildAgent)
|
||||
{
|
||||
returnAgent = queryagent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnAgent;
|
||||
}
|
||||
|
||||
private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID)
|
||||
{
|
||||
List<Scene> scenes = null;
|
||||
lock (m_scenes)
|
||||
scenes = new List<Scene>(m_scenes.Values);
|
||||
|
||||
ScenePresence returnAgent = null;
|
||||
ScenePresence queryagent = null;
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
queryagent = scene.GetScenePresence(AgentID);
|
||||
if (queryagent != null)
|
||||
{
|
||||
returnAgent = queryagent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return returnAgent;
|
||||
}
|
||||
|
||||
|
||||
@@ -290,13 +290,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
|
||||
// get the agent. This should work every time, as we just got a packet from it
|
||||
ScenePresence agent = null;
|
||||
List<Scene> scenes = null;
|
||||
lock (m_Scenes)
|
||||
scenes = new List<Scene>(m_Scenes);
|
||||
|
||||
foreach (Scene scene in scenes)
|
||||
{
|
||||
foreach (Scene scene in m_Scenes)
|
||||
{
|
||||
agent = scene.GetScenePresence(agentID);
|
||||
if (agent != null) break;
|
||||
}
|
||||
agent = scene.GetScenePresence(agentID);
|
||||
if (agent != null) break;
|
||||
}
|
||||
|
||||
// just to be paranoid...
|
||||
|
||||
@@ -111,16 +111,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
|
||||
private Scene FindClientScene(UUID agentId)
|
||||
{
|
||||
List<Scene> scenes = null;
|
||||
lock (m_Scenelist)
|
||||
scenes = new List<Scene>(m_Scenelist);
|
||||
|
||||
foreach (Scene scene in scenes)
|
||||
{
|
||||
foreach (Scene scene in m_Scenelist)
|
||||
ScenePresence presence = scene.GetScenePresence(agentId);
|
||||
if (presence != null)
|
||||
{
|
||||
ScenePresence presence = scene.GetScenePresence(agentId);
|
||||
if (presence != null)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
return scene;
|
||||
}
|
||||
if (!presence.IsChildAgent)
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user