diff options
author | Diva Canto | 2009-10-06 15:39:53 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-06 15:39:53 -0700 |
commit | e992ca025571a891333a57012c2cd4419b6581e5 (patch) | |
tree | a6fd7e9f2e46999c72780bf60d2890e8a9c74fe4 /OpenSim/Region/CoreModules/Avatar/Friends | |
parent | * Change some more default ports to the robust default of 8003 (diff) | |
download | opensim-SC_OLD-e992ca025571a891333a57012c2cd4419b6581e5.zip opensim-SC_OLD-e992ca025571a891333a57012c2cd4419b6581e5.tar.gz opensim-SC_OLD-e992ca025571a891333a57012c2cd4419b6581e5.tar.bz2 opensim-SC_OLD-e992ca025571a891333a57012c2cd4419b6581e5.tar.xz |
Rewrote parts of the code that were double-locking different objects. This is about half of the code base reviewed.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index fc7d63a..4abad81 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -442,42 +442,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
442 | 442 | ||
443 | private ScenePresence GetRootPresenceFromAgentID(UUID AgentID) | 443 | private ScenePresence GetRootPresenceFromAgentID(UUID AgentID) |
444 | { | 444 | { |
445 | ScenePresence returnAgent = null; | 445 | List<Scene> scenes = null; |
446 | lock (m_scenes) | 446 | lock (m_scenes) |
447 | scenes = new List<Scene>(m_scenes.Values); | ||
448 | |||
449 | ScenePresence returnAgent = null; | ||
450 | ScenePresence queryagent = null; | ||
451 | foreach (Scene scene in scenes) | ||
447 | { | 452 | { |
448 | ScenePresence queryagent = null; | 453 | queryagent = scene.GetScenePresence(AgentID); |
449 | foreach (Scene scene in m_scenes.Values) | 454 | if (queryagent != null) |
450 | { | 455 | { |
451 | queryagent = scene.GetScenePresence(AgentID); | 456 | if (!queryagent.IsChildAgent) |
452 | if (queryagent != null) | ||
453 | { | 457 | { |
454 | if (!queryagent.IsChildAgent) | 458 | returnAgent = queryagent; |
455 | { | 459 | break; |
456 | returnAgent = queryagent; | ||
457 | break; | ||
458 | } | ||
459 | } | 460 | } |
460 | } | 461 | } |
461 | } | 462 | } |
463 | |||
462 | return returnAgent; | 464 | return returnAgent; |
463 | } | 465 | } |
464 | 466 | ||
465 | private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID) | 467 | private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID) |
466 | { | 468 | { |
467 | ScenePresence returnAgent = null; | 469 | List<Scene> scenes = null; |
468 | lock (m_scenes) | 470 | lock (m_scenes) |
471 | scenes = new List<Scene>(m_scenes.Values); | ||
472 | |||
473 | ScenePresence returnAgent = null; | ||
474 | ScenePresence queryagent = null; | ||
475 | foreach (Scene scene in m_scenes.Values) | ||
469 | { | 476 | { |
470 | ScenePresence queryagent = null; | 477 | queryagent = scene.GetScenePresence(AgentID); |
471 | foreach (Scene scene in m_scenes.Values) | 478 | if (queryagent != null) |
472 | { | 479 | { |
473 | queryagent = scene.GetScenePresence(AgentID); | 480 | returnAgent = queryagent; |
474 | if (queryagent != null) | 481 | break; |
475 | { | ||
476 | returnAgent = queryagent; | ||
477 | break; | ||
478 | } | ||
479 | } | 482 | } |
480 | } | 483 | } |
484 | |||
481 | return returnAgent; | 485 | return returnAgent; |
482 | } | 486 | } |
483 | 487 | ||