aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
authorMelanie2009-10-07 01:45:49 +0100
committerMelanie2009-10-07 01:45:49 +0100
commit89d23a1fa23cb191e7ebde047311adcadf3b2e45 (patch)
tree461ef0fdd6640a17db5b3d989f0e02b1cf40252e /OpenSim/Region/CoreModules/Avatar
parentRewrote parts of the code that were double-locking different objects. This is... (diff)
downloadopensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.zip
opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.gz
opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.bz2
opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.xz
Revert "Rewrote parts of the code that were double-locking different objects. This is about half of the code base reviewed."
This reverts commit e992ca025571a891333a57012c2cd4419b6581e5.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs42
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs15
3 files changed, 31 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 4abad81..fc7d63a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -442,46 +442,42 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
442 442
443 private ScenePresence GetRootPresenceFromAgentID(UUID AgentID) 443 private ScenePresence GetRootPresenceFromAgentID(UUID AgentID)
444 { 444 {
445 List<Scene> scenes = null;
446 lock (m_scenes)
447 scenes = new List<Scene>(m_scenes.Values);
448
449 ScenePresence returnAgent = null; 445 ScenePresence returnAgent = null;
450 ScenePresence queryagent = null; 446 lock (m_scenes)
451 foreach (Scene scene in scenes)
452 { 447 {
453 queryagent = scene.GetScenePresence(AgentID); 448 ScenePresence queryagent = null;
454 if (queryagent != null) 449 foreach (Scene scene in m_scenes.Values)
455 { 450 {
456 if (!queryagent.IsChildAgent) 451 queryagent = scene.GetScenePresence(AgentID);
452 if (queryagent != null)
457 { 453 {
458 returnAgent = queryagent; 454 if (!queryagent.IsChildAgent)
459 break; 455 {
456 returnAgent = queryagent;
457 break;
458 }
460 } 459 }
461 } 460 }
462 } 461 }
463
464 return returnAgent; 462 return returnAgent;
465 } 463 }
466 464
467 private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID) 465 private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID)
468 { 466 {
469 List<Scene> scenes = null;
470 lock (m_scenes)
471 scenes = new List<Scene>(m_scenes.Values);
472
473 ScenePresence returnAgent = null; 467 ScenePresence returnAgent = null;
474 ScenePresence queryagent = null; 468 lock (m_scenes)
475 foreach (Scene scene in m_scenes.Values)
476 { 469 {
477 queryagent = scene.GetScenePresence(AgentID); 470 ScenePresence queryagent = null;
478 if (queryagent != null) 471 foreach (Scene scene in m_scenes.Values)
479 { 472 {
480 returnAgent = queryagent; 473 queryagent = scene.GetScenePresence(AgentID);
481 break; 474 if (queryagent != null)
475 {
476 returnAgent = queryagent;
477 break;
478 }
482 } 479 }
483 } 480 }
484
485 return returnAgent; 481 return returnAgent;
486 } 482 }
487 483
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index 42dd7ff..ad05bab 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -290,14 +290,13 @@ 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;
294 lock (m_Scenes) 293 lock (m_Scenes)
295 scenes = new List<Scene>(m_Scenes);
296
297 foreach (Scene scene in scenes)
298 { 294 {
299 agent = scene.GetScenePresence(agentID); 295 foreach (Scene scene in m_Scenes)
300 if (agent != null) break; 296 {
297 agent = scene.GetScenePresence(agentID);
298 if (agent != null) break;
299 }
301 } 300 }
302 301
303 // just to be paranoid... 302 // 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 e6e0483..d9a021f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -111,17 +111,16 @@ 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;
115 lock (m_Scenelist) 114 lock (m_Scenelist)
116 scenes = new List<Scene>(m_Scenelist);
117
118 foreach (Scene scene in scenes)
119 { 115 {
120 ScenePresence presence = scene.GetScenePresence(agentId); 116 foreach (Scene scene in m_Scenelist)
121 if (presence != null)
122 { 117 {
123 if (!presence.IsChildAgent) 118 ScenePresence presence = scene.GetScenePresence(agentId);
124 return scene; 119 if (presence != null)
120 {
121 if (!presence.IsChildAgent)
122 return scene;
123 }
125 } 124 }
126 } 125 }
127 return null; 126 return null;