aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorDan Lake2010-03-17 06:40:00 -0700
committerJohn Hurliman2010-03-17 11:21:27 -0700
commit73e9b0be725a73a489b29f3fe2df236c897ef3b5 (patch)
tree0d039d61d327e98ed22e4bce30de65c24fc5780d /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentminor logging changes to BaseHttpServer, OSHttpRequest (diff)
downloadopensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.zip
opensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.tar.gz
opensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.tar.bz2
opensim-SC_OLD-73e9b0be725a73a489b29f3fe2df236c897ef3b5.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs20
1 files changed, 7 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6f16ff3..766f6d3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -912,14 +912,11 @@ namespace OpenSim.Region.Framework.Scenes
912 912
913 m_isChildAgent = false; 913 m_isChildAgent = false;
914 914
915 ScenePresence[] animAgents = m_scene.GetScenePresences(); 915 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
916 for (int i = 0; i < animAgents.Length; i++)
917 { 916 {
918 ScenePresence presence = animAgents[i];
919
920 if (presence != this) 917 if (presence != this)
921 presence.Animator.SendAnimPackToClient(ControllingClient); 918 presence.Animator.SendAnimPackToClient(ControllingClient);
922 } 919 });
923 920
924 m_scene.EventManager.TriggerOnMakeRootAgent(this); 921 m_scene.EventManager.TriggerOnMakeRootAgent(this);
925 } 922 }
@@ -2469,13 +2466,10 @@ namespace OpenSim.Region.Framework.Scenes
2469 public void SendInitialFullUpdateToAllClients() 2466 public void SendInitialFullUpdateToAllClients()
2470 { 2467 {
2471 m_perfMonMS = Util.EnvironmentTickCount(); 2468 m_perfMonMS = Util.EnvironmentTickCount();
2472 2469 int avUpdates = 0;
2473 ScenePresence[] avatars = m_scene.GetScenePresences(); 2470 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
2474
2475 for (int i = 0; i < avatars.Length; i++)
2476 { 2471 {
2477 ScenePresence avatar = avatars[i]; 2472 ++avUpdates;
2478
2479 // only send if this is the root (children are only "listening posts" in a foreign region) 2473 // only send if this is the root (children are only "listening posts" in a foreign region)
2480 if (!IsChildAgent) 2474 if (!IsChildAgent)
2481 { 2475 {
@@ -2491,9 +2485,9 @@ namespace OpenSim.Region.Framework.Scenes
2491 avatar.Animator.SendAnimPackToClient(ControllingClient); 2485 avatar.Animator.SendAnimPackToClient(ControllingClient);
2492 } 2486 }
2493 } 2487 }
2494 } 2488 });
2495 2489
2496 m_scene.StatsReporter.AddAgentUpdates(avatars.Length); 2490 m_scene.StatsReporter.AddAgentUpdates(avUpdates);
2497 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2491 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2498 2492
2499 //Animator.SendAnimPack(); 2493 //Animator.SendAnimPack();