diff options
author | Dan Lake | 2010-03-17 06:40:00 -0700 |
---|---|---|
committer | John Hurliman | 2010-03-17 11:21:27 -0700 |
commit | 73e9b0be725a73a489b29f3fe2df236c897ef3b5 (patch) | |
tree | 0d039d61d327e98ed22e4bce30de65c24fc5780d /OpenSim/Region/Framework/Scenes/SceneManager.cs | |
parent | minor logging changes to BaseHttpServer, OSHttpRequest (diff) | |
download | opensim-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 '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneManager.cs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 680c39a..a955532 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -414,12 +414,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
414 | ForEachCurrentScene( | 414 | ForEachCurrentScene( |
415 | delegate(Scene scene) | 415 | delegate(Scene scene) |
416 | { | 416 | { |
417 | ScenePresence[] scenePresences = scene.GetScenePresences(); | 417 | scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
418 | |||
419 | for (int i = 0; i < scenePresences.Length; i++) | ||
420 | { | 418 | { |
421 | ScenePresence scenePresence = scenePresences[i]; | ||
422 | |||
423 | if (!scenePresence.IsChildAgent) | 419 | if (!scenePresence.IsChildAgent) |
424 | { | 420 | { |
425 | m_log.DebugFormat("Packet debug for {0} {1} set to {2}", | 421 | m_log.DebugFormat("Packet debug for {0} {1} set to {2}", |
@@ -429,7 +425,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
429 | 425 | ||
430 | scenePresence.ControllingClient.SetDebugPacketLevel(newDebug); | 426 | scenePresence.ControllingClient.SetDebugPacketLevel(newDebug); |
431 | } | 427 | } |
432 | } | 428 | }); |
433 | } | 429 | } |
434 | ); | 430 | ); |
435 | } | 431 | } |
@@ -441,14 +437,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
441 | ForEachCurrentScene( | 437 | ForEachCurrentScene( |
442 | delegate(Scene scene) | 438 | delegate(Scene scene) |
443 | { | 439 | { |
444 | ScenePresence[] scenePresences = scene.GetScenePresences(); | 440 | scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
445 | |||
446 | for (int i = 0; i < scenePresences.Length; i++) | ||
447 | { | 441 | { |
448 | ScenePresence scenePresence = scenePresences[i]; | ||
449 | if (!scenePresence.IsChildAgent) | 442 | if (!scenePresence.IsChildAgent) |
450 | avatars.Add(scenePresence); | 443 | avatars.Add(scenePresence); |
451 | } | 444 | }); |
452 | } | 445 | } |
453 | ); | 446 | ); |
454 | 447 | ||
@@ -461,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
461 | 454 | ||
462 | ForEachCurrentScene(delegate(Scene scene) | 455 | ForEachCurrentScene(delegate(Scene scene) |
463 | { | 456 | { |
464 | ScenePresence[] scenePresences = scene.GetScenePresences(); | 457 | List<ScenePresence> scenePresences = scene.GetScenePresences(); |
465 | presences.AddRange(scenePresences); | 458 | presences.AddRange(scenePresences); |
466 | }); | 459 | }); |
467 | 460 | ||