* Slightly increase ScenePresences locking where it's technically required in SceneGraph

0.6.2-post-fixes
Justin Clarke Casey 2009-01-07 19:33:20 +00:00
parent 8d035b196d
commit 9e297cd722
1 changed files with 25 additions and 17 deletions

View File

@ -837,7 +837,11 @@ namespace OpenSim.Region.Environment.Scenes
protected internal ScenePresence GetScenePresence(UUID agentID) protected internal ScenePresence GetScenePresence(UUID agentID)
{ {
ScenePresence sp; ScenePresence sp;
ScenePresences.TryGetValue(agentID, out sp);
lock (ScenePresences)
{
ScenePresences.TryGetValue(agentID, out sp);
}
return sp; return sp;
} }
@ -968,22 +972,26 @@ namespace OpenSim.Region.Environment.Scenes
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
{ {
ScenePresence presence; ScenePresence presence;
if (ScenePresences.TryGetValue(avatarId, out presence))
{
avatar = presence;
return true;
//if (!presence.IsChildAgent) lock (ScenePresences)
//{ {
// avatar = presence; if (ScenePresences.TryGetValue(avatarId, out presence))
// return true; {
//} avatar = presence;
//else return true;
//{
// m_log.WarnFormat( //if (!presence.IsChildAgent)
// "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!", //{
// avatarId, m_parentScene.RegionInfo.RegionName); // avatar = presence;
//} // return true;
//}
//else
//{
// m_log.WarnFormat(
// "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!",
// avatarId, m_parentScene.RegionInfo.RegionName);
//}
}
} }
avatar = null; avatar = null;
@ -1477,13 +1485,13 @@ namespace OpenSim.Region.Environment.Scenes
// We need to explicitly resend the newly link prim's object properties since no other actions // We need to explicitly resend the newly link prim's object properties since no other actions
// occur on link to invoke this elsewhere (such as object selection) // occur on link to invoke this elsewhere (such as object selection)
parenPrim.RootPart.AddFlag(PrimFlags.CreateSelected); parenPrim.RootPart.AddFlag(PrimFlags.CreateSelected);
parenPrim.TriggerScriptChangedEvent(Changed.LINK); parenPrim.TriggerScriptChangedEvent(Changed.LINK);
if (client != null) if (client != null)
parenPrim.GetProperties(client); parenPrim.GetProperties(client);
else else
{ {
foreach (ScenePresence p in ScenePresences.Values) foreach (ScenePresence p in GetScenePresences())
{ {
parenPrim.GetProperties(p.ControllingClient); parenPrim.GetProperties(p.ControllingClient);
} }