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 | |
parent | * Change some more default ports to the robust default of 8003 (diff) | |
download | opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.zip opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.tar.gz opensim-SC-e992ca025571a891333a57012c2cd4419b6581e5.tar.bz2 opensim-SC-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')
3 files changed, 37 insertions, 31 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 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index ad05bab..42dd7ff 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -290,13 +290,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
290 | 290 | ||
291 | // get the agent. This should work every time, as we just got a packet from it | 291 | // get the agent. This should work every time, as we just got a packet from it |
292 | ScenePresence agent = null; | 292 | ScenePresence agent = null; |
293 | List<Scene> scenes = null; | ||
293 | lock (m_Scenes) | 294 | lock (m_Scenes) |
295 | scenes = new List<Scene>(m_Scenes); | ||
296 | |||
297 | foreach (Scene scene in scenes) | ||
294 | { | 298 | { |
295 | foreach (Scene scene in m_Scenes) | 299 | agent = scene.GetScenePresence(agentID); |
296 | { | 300 | if (agent != null) break; |
297 | agent = scene.GetScenePresence(agentID); | ||
298 | if (agent != null) break; | ||
299 | } | ||
300 | } | 301 | } |
301 | 302 | ||
302 | // just to be paranoid... | 303 | // just to be paranoid... |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index d9a021f..e6e0483 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -111,16 +111,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
111 | 111 | ||
112 | private Scene FindClientScene(UUID agentId) | 112 | private Scene FindClientScene(UUID agentId) |
113 | { | 113 | { |
114 | List<Scene> scenes = null; | ||
114 | lock (m_Scenelist) | 115 | lock (m_Scenelist) |
116 | scenes = new List<Scene>(m_Scenelist); | ||
117 | |||
118 | foreach (Scene scene in scenes) | ||
115 | { | 119 | { |
116 | foreach (Scene scene in m_Scenelist) | 120 | ScenePresence presence = scene.GetScenePresence(agentId); |
121 | if (presence != null) | ||
117 | { | 122 | { |
118 | ScenePresence presence = scene.GetScenePresence(agentId); | 123 | if (!presence.IsChildAgent) |
119 | if (presence != null) | 124 | return scene; |
120 | { | ||
121 | if (!presence.IsChildAgent) | ||
122 | return scene; | ||
123 | } | ||
124 | } | 125 | } |
125 | } | 126 | } |
126 | return null; | 127 | return null; |