mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Inconsistent locking of ScenePresence array in SceneGraph. Fixed by eliminating option to return the actual list. Callers can now either request a copy of the array as a new List or ask the SceneGraph to call a delegate function on every ScenePresence. Iteration and locking of the ScenePresences now takes place only within the SceneGraph class.
This patch also applies a fix to Combat/CombatModule.cs which had unlocked iteration of the ScenePresences and inconsistent try/catch around the use of those ScenePresences.
This commit is contained in:
@@ -1197,15 +1197,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private void SendObjectPropertiesToClient(UUID AgentID)
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
// Ugly reference :(
|
||||
if (avatars[i].UUID == AgentID)
|
||||
if (avatar.UUID == AgentID)
|
||||
{
|
||||
m_parentGroup.GetProperties(avatars[i].ControllingClient);
|
||||
m_parentGroup.GetProperties(avatar.ControllingClient);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: unused:
|
||||
@@ -1260,11 +1259,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void AddFullUpdateToAllAvatars()
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||
}
|
||||
avatar.SceneViewer.QueuePartForUpdate(this);
|
||||
});
|
||||
}
|
||||
|
||||
public void AddFullUpdateToAvatar(ScenePresence presence)
|
||||
@@ -1285,11 +1283,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Terse updates
|
||||
public void AddTerseUpdateToAllAvatars()
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||
}
|
||||
avatar.SceneViewer.QueuePartForUpdate(this);
|
||||
});
|
||||
}
|
||||
|
||||
public void AddTerseUpdateToAvatar(ScenePresence presence)
|
||||
@@ -2121,17 +2118,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < avlist.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av)
|
||||
{
|
||||
ScenePresence av = avlist[i];
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
|
||||
{
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar
|
||||
if (found)
|
||||
{
|
||||
@@ -2153,7 +2146,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
|
||||
if (!found)
|
||||
{
|
||||
@@ -2171,7 +2164,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (colliding.Count > 0)
|
||||
@@ -2257,17 +2250,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < avlist.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av)
|
||||
{
|
||||
ScenePresence av = avlist[i];
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
|
||||
{
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar
|
||||
if (found)
|
||||
{
|
||||
@@ -2289,7 +2278,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
|
||||
if (!found)
|
||||
{
|
||||
@@ -2307,7 +2296,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (colliding.Count > 0)
|
||||
@@ -2388,17 +2377,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < avlist.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av)
|
||||
{
|
||||
ScenePresence av = avlist[i];
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
|
||||
{
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar
|
||||
if (found)
|
||||
{
|
||||
@@ -2420,7 +2405,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
|
||||
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
|
||||
//If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
|
||||
if (!found)
|
||||
{
|
||||
@@ -2438,7 +2423,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2877,11 +2862,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void SendFullUpdateToAllClients()
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
SendFullUpdate(avatars[i].ControllingClient, avatars[i].GenerateClientFlags(UUID));
|
||||
}
|
||||
SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2890,13 +2874,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="agentID"></param>
|
||||
public void SendFullUpdateToAllClientsExcept(UUID agentID)
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
// Ugly reference :(
|
||||
if (avatars[i].UUID != agentID)
|
||||
SendFullUpdate(avatars[i].ControllingClient, avatars[i].GenerateClientFlags(UUID));
|
||||
}
|
||||
if (avatar.UUID != agentID)
|
||||
SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3096,11 +3079,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void SendTerseUpdateToAllClients()
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||
{
|
||||
SendTerseUpdateToClient(avatars[i].ControllingClient);
|
||||
}
|
||||
SendTerseUpdateToClient(avatar.ControllingClient);
|
||||
});
|
||||
}
|
||||
|
||||
public void SetAttachmentPoint(uint AttachmentPoint)
|
||||
|
||||
Reference in New Issue
Block a user