aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-06 15:54:00 -0700
committerJohn Hurliman2009-10-06 15:54:00 -0700
commit832cc685138b2244529f10b54b373c34adb4a633 (patch)
tree888cf05d2d0bacdd8acec47150075423d07ed3ee /OpenSim
parentChecks the number of ThreadPool and IOCP threads on startup and bumps up the ... (diff)
parentRewrote parts of the code that were double-locking different objects. This is... (diff)
downloadopensim-SC-832cc685138b2244529f10b54b373c34adb4a633.zip
opensim-SC-832cc685138b2244529f10b54b373c34adb4a633.tar.gz
opensim-SC-832cc685138b2244529f10b54b373c34adb4a633.tar.bz2
opensim-SC-832cc685138b2244529f10b54b373c34adb4a633.tar.xz
Merging in diva's locking fixes
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs66
-rw-r--r--OpenSim/Framework/ConfigSettings.cs4
-rw-r--r--OpenSim/Framework/InventoryConfig.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs116
-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
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs36
-rw-r--r--OpenSim/Tests/Clients/Grid/GridClient.cs2
12 files changed, 207 insertions, 172 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 9e12d948..b02cf5b 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -128,24 +128,18 @@ namespace OpenSim.Framework.Communications.Cache
128 /// <returns>null if no user details are found</returns> 128 /// <returns>null if no user details are found</returns>
129 public CachedUserInfo GetUserDetails(string fname, string lname) 129 public CachedUserInfo GetUserDetails(string fname, string lname)
130 { 130 {
131 CachedUserInfo userInfo;
131 lock (m_userProfilesByName) 132 lock (m_userProfilesByName)
132 { 133 {
133 CachedUserInfo userInfo;
134
135 if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo)) 134 if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo))
136 {
137 return userInfo; 135 return userInfo;
138 }
139 else
140 {
141 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
142
143 if (userProfile != null)
144 return AddToCaches(userProfile);
145 else
146 return null;
147 }
148 } 136 }
137 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
138
139 if (userProfile != null)
140 return AddToCaches(userProfile);
141 else
142 return null;
149 } 143 }
150 144
151 /// <summary> 145 /// <summary>
@@ -160,20 +154,14 @@ namespace OpenSim.Framework.Communications.Cache
160 return null; 154 return null;
161 155
162 lock (m_userProfilesById) 156 lock (m_userProfilesById)
163 {
164 if (m_userProfilesById.ContainsKey(userID)) 157 if (m_userProfilesById.ContainsKey(userID))
165 {
166 return m_userProfilesById[userID]; 158 return m_userProfilesById[userID];
167 } 159
168 else 160 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
169 { 161 if (userProfile != null)
170 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); 162 return AddToCaches(userProfile);
171 if (userProfile != null) 163 else
172 return AddToCaches(userProfile); 164 return null;
173 else
174 return null;
175 }
176 }
177 } 165 }
178 166
179 /// <summary> 167 /// <summary>
@@ -211,14 +199,10 @@ namespace OpenSim.Framework.Communications.Cache
211 CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile); 199 CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
212 200
213 lock (m_userProfilesById) 201 lock (m_userProfilesById)
214 {
215 m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo; 202 m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo;
216 203
217 lock (m_userProfilesByName) 204 lock (m_userProfilesByName)
218 { 205 m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo;
219 m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo;
220 }
221 }
222 206
223 return createdUserInfo; 207 return createdUserInfo;
224 } 208 }
@@ -230,21 +214,25 @@ namespace OpenSim.Framework.Communications.Cache
230 /// <returns>true if there was a profile to remove, false otherwise</returns> 214 /// <returns>true if there was a profile to remove, false otherwise</returns>
231 protected bool RemoveFromCaches(UUID userId) 215 protected bool RemoveFromCaches(UUID userId)
232 { 216 {
217 CachedUserInfo userInfo = null;
233 lock (m_userProfilesById) 218 lock (m_userProfilesById)
234 { 219 {
235 if (m_userProfilesById.ContainsKey(userId)) 220 if (m_userProfilesById.ContainsKey(userId))
236 { 221 {
237 CachedUserInfo userInfo = m_userProfilesById[userId]; 222 userInfo = m_userProfilesById[userId];
238 m_userProfilesById.Remove(userId); 223 m_userProfilesById.Remove(userId);
239 224 }
240 lock (m_userProfilesByName) 225 }
226
227 if (userInfo != null)
228 lock (m_userProfilesByName)
229 {
230 if (m_userProfilesByName.ContainsKey(userInfo.UserProfile.Name))
241 { 231 {
242 m_userProfilesByName.Remove(userInfo.UserProfile.Name); 232 m_userProfilesByName.Remove(userInfo.UserProfile.Name);
233 return true;
243 } 234 }
244
245 return true;
246 } 235 }
247 }
248 236
249 return false; 237 return false;
250 } 238 }
diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs
index 93efffa..32415e0 100644
--- a/OpenSim/Framework/ConfigSettings.cs
+++ b/OpenSim/Framework/ConfigSettings.cs
@@ -168,7 +168,7 @@ namespace OpenSim.Framework
168 public const bool DefaultUserServerHttpSSL = false; 168 public const bool DefaultUserServerHttpSSL = false;
169 public const uint DefaultMessageServerHttpPort = 8006; 169 public const uint DefaultMessageServerHttpPort = 8006;
170 public const bool DefaultMessageServerHttpSSL = false; 170 public const bool DefaultMessageServerHttpSSL = false;
171 public const uint DefaultGridServerHttpPort = 8001; 171 public const uint DefaultGridServerHttpPort = 8003;
172 public const uint DefaultInventoryServerHttpPort = 8004; 172 public const uint DefaultInventoryServerHttpPort = 8003;
173 } 173 }
174} 174}
diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs
index f539d55..dd207ad 100644
--- a/OpenSim/Framework/InventoryConfig.cs
+++ b/OpenSim/Framework/InventoryConfig.cs
@@ -56,15 +56,15 @@ namespace OpenSim.Framework
56 m_configMember.addConfigurationOption("default_inventory_server", 56 m_configMember.addConfigurationOption("default_inventory_server",
57 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 57 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
58 "Default Inventory Server URI (this server's external name)", 58 "Default Inventory Server URI (this server's external name)",
59 "http://127.0.0.1:8004", false); 59 "http://127.0.0.1:" + ConfigSettings.DefaultInventoryServerHttpPort, false);
60 m_configMember.addConfigurationOption("default_user_server", 60 m_configMember.addConfigurationOption("default_user_server",
61 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 61 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
62 "Default User Server URI", 62 "Default User Server URI",
63 "http://127.0.0.1:8002", false); 63 "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort, false);
64 m_configMember.addConfigurationOption("default_asset_server", 64 m_configMember.addConfigurationOption("default_asset_server",
65 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 65 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
66 "Default Asset Server URI", 66 "Default Asset Server URI",
67 "http://127.0.0.1:8003", false); 67 "http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort, false);
68 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 68 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
69 "DLL for database provider", "OpenSim.Data.MySQL.dll", false); 69 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
70 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 70 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 84e705a..60dab5f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3546,6 +3546,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3546 objectData.TextureAnim = textureanim; 3546 objectData.TextureAnim = textureanim;
3547 } 3547 }
3548 3548
3549 bool doUpdate = false;
3549 lock (m_primFullUpdates) 3550 lock (m_primFullUpdates)
3550 { 3551 {
3551 if (m_primFullUpdates.Count == 0) 3552 if (m_primFullUpdates.Count == 0)
@@ -3554,8 +3555,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3554 m_primFullUpdates.Add(objectData); 3555 m_primFullUpdates.Add(objectData);
3555 3556
3556 if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) 3557 if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket)
3557 ProcessPrimFullUpdates(this, null); 3558 doUpdate = true;
3558 } 3559 }
3560 if (doUpdate)
3561 ProcessPrimFullUpdates(this, null);
3559 } 3562 }
3560 3563
3561 void HandleQueueEmpty(ThrottleOutPacketType queue) 3564 void HandleQueueEmpty(ThrottleOutPacketType queue)
@@ -3576,35 +3579,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3576 3579
3577 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) 3580 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
3578 { 3581 {
3582 bool stopTimer = false;
3579 lock (m_primFullUpdates) 3583 lock (m_primFullUpdates)
3580 { 3584 {
3581 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3585 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3582 { 3586 stopTimer = true;
3583 lock (m_primFullUpdateTimer) 3587 }
3584 m_primFullUpdateTimer.Stop(); 3588 if (stopTimer)
3585 3589 {
3586 return; 3590 lock (m_primFullUpdateTimer)
3587 } 3591 m_primFullUpdateTimer.Stop();
3592 return;
3593 }
3588 3594
3589 ObjectUpdatePacket outPacket = 3595 ObjectUpdatePacket outPacket =
3590 (ObjectUpdatePacket)PacketPool.Instance.GetPacket( 3596 (ObjectUpdatePacket)PacketPool.Instance.GetPacket(
3591 PacketType.ObjectUpdate); 3597 PacketType.ObjectUpdate);
3592 3598
3593 outPacket.RegionData.RegionHandle = 3599 outPacket.RegionData.RegionHandle =
3594 Scene.RegionInfo.RegionHandle; 3600 Scene.RegionInfo.RegionHandle;
3595 outPacket.RegionData.TimeDilation = 3601 outPacket.RegionData.TimeDilation =
3596 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3602 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3597 3603
3598 int max = m_primFullUpdates.Count; 3604 int max = m_primFullUpdates.Count;
3599 if (max > m_primFullUpdatesPerPacket) 3605 if (max > m_primFullUpdatesPerPacket)
3600 max = m_primFullUpdatesPerPacket; 3606 max = m_primFullUpdatesPerPacket;
3601 3607
3602 int count = 0; 3608 int count = 0;
3603 int size = 0; 3609 int size = 0;
3604 3610
3605 byte[] zerobuffer = new byte[1024]; 3611 byte[] zerobuffer = new byte[1024];
3606 byte[] blockbuffer = new byte[1024]; 3612 byte[] blockbuffer = new byte[1024];
3607 3613
3614 lock (m_primFullUpdates)
3615 {
3608 for (count = 0 ; count < max ; count++) 3616 for (count = 0 ; count < max ; count++)
3609 { 3617 {
3610 int length = 0; 3618 int length = 0;
@@ -3628,9 +3636,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3628 OutPacket(outPacket, ThrottleOutPacketType.Task); 3636 OutPacket(outPacket, ThrottleOutPacketType.Task);
3629 3637
3630 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3638 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3631 lock (m_primFullUpdateTimer) 3639 stopTimer = true;
3632 m_primFullUpdateTimer.Stop();
3633 } 3640 }
3641
3642 if (stopTimer)
3643 lock (m_primFullUpdateTimer)
3644 m_primFullUpdateTimer.Stop();
3634 } 3645 }
3635 3646
3636 /// <summary> 3647 /// <summary>
@@ -3649,6 +3660,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3649 CreatePrimImprovedBlock(localID, position, rotation, 3660 CreatePrimImprovedBlock(localID, position, rotation,
3650 velocity, rotationalvelocity, state); 3661 velocity, rotationalvelocity, state);
3651 3662
3663 bool doUpdate = false;
3652 lock (m_primTerseUpdates) 3664 lock (m_primTerseUpdates)
3653 { 3665 {
3654 if (m_primTerseUpdates.Count == 0) 3666 if (m_primTerseUpdates.Count == 0)
@@ -3657,43 +3669,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3657 m_primTerseUpdates.Add(objectData); 3669 m_primTerseUpdates.Add(objectData);
3658 3670
3659 if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) 3671 if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket)
3660 ProcessPrimTerseUpdates(this, null); 3672 doUpdate = true;
3661 } 3673 }
3674 if (doUpdate)
3675 ProcessPrimTerseUpdates(this, null);
3662 } 3676 }
3663 3677
3664 void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) 3678 void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e)
3665 { 3679 {
3680 bool stopTimer = false;
3666 lock (m_primTerseUpdates) 3681 lock (m_primTerseUpdates)
3667 { 3682 {
3668 if (m_primTerseUpdates.Count == 0) 3683 if (m_primTerseUpdates.Count == 0)
3669 { 3684 stopTimer = true;
3670 lock (m_primTerseUpdateTimer) 3685 }
3671 m_primTerseUpdateTimer.Stop(); 3686 if (stopTimer)
3687 {
3688 lock (m_primTerseUpdateTimer)
3689 m_primTerseUpdateTimer.Stop();
3672 3690
3673 return; 3691 return;
3674 } 3692 }
3675 3693
3676 ImprovedTerseObjectUpdatePacket outPacket = 3694 ImprovedTerseObjectUpdatePacket outPacket =
3677 (ImprovedTerseObjectUpdatePacket) 3695 (ImprovedTerseObjectUpdatePacket)
3678 PacketPool.Instance.GetPacket( 3696 PacketPool.Instance.GetPacket(
3679 PacketType.ImprovedTerseObjectUpdate); 3697 PacketType.ImprovedTerseObjectUpdate);
3680 3698
3681 outPacket.RegionData.RegionHandle = 3699 outPacket.RegionData.RegionHandle =
3682 Scene.RegionInfo.RegionHandle; 3700 Scene.RegionInfo.RegionHandle;
3683 outPacket.RegionData.TimeDilation = 3701 outPacket.RegionData.TimeDilation =
3684 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3702 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3685 3703
3686 int max = m_primTerseUpdates.Count; 3704 int max = m_primTerseUpdates.Count;
3687 if (max > m_primTerseUpdatesPerPacket) 3705 if (max > m_primTerseUpdatesPerPacket)
3688 max = m_primTerseUpdatesPerPacket; 3706 max = m_primTerseUpdatesPerPacket;
3689 3707
3690 int count = 0; 3708 int count = 0;
3691 int size = 0; 3709 int size = 0;
3692 3710
3693 byte[] zerobuffer = new byte[1024]; 3711 byte[] zerobuffer = new byte[1024];
3694 byte[] blockbuffer = new byte[1024]; 3712 byte[] blockbuffer = new byte[1024];
3695 3713
3696 for (count = 0 ; count < max ; count++) 3714 lock (m_primTerseUpdates)
3715 {
3716 for (count = 0; count < max; count++)
3697 { 3717 {
3698 int length = 0; 3718 int length = 0;
3699 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); 3719 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
@@ -3718,9 +3738,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3718 OutPacket(outPacket, ThrottleOutPacketType.Task); 3738 OutPacket(outPacket, ThrottleOutPacketType.Task);
3719 3739
3720 if (m_primTerseUpdates.Count == 0) 3740 if (m_primTerseUpdates.Count == 0)
3721 lock (m_primTerseUpdateTimer) 3741 stopTimer = true;
3722 m_primTerseUpdateTimer.Stop();
3723 } 3742 }
3743 if (stopTimer)
3744 lock (m_primTerseUpdateTimer)
3745 m_primTerseUpdateTimer.Stop();
3724 } 3746 }
3725 3747
3726 public void FlushPrimUpdates() 3748 public void FlushPrimUpdates()
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;
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index 83f004d..f9f01fe 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -198,19 +198,20 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
198 198
199 private SceneObjectPart findPrim(UUID objectID, out string ObjectRegionName) 199 private SceneObjectPart findPrim(UUID objectID, out string ObjectRegionName)
200 { 200 {
201 List<Scene> scenes = null;
201 lock (m_Scenes) 202 lock (m_Scenes)
203 scenes = new List<Scene>(m_Scenes.Values);
204
205 foreach (Scene s in scenes)
202 { 206 {
203 foreach (Scene s in m_Scenes.Values) 207 SceneObjectPart part = s.GetSceneObjectPart(objectID);
208 if (part != null)
204 { 209 {
205 SceneObjectPart part = s.GetSceneObjectPart(objectID); 210 ObjectRegionName = s.RegionInfo.RegionName;
206 if (part != null) 211 uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize);
207 { 212 uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize);
208 ObjectRegionName = s.RegionInfo.RegionName; 213 ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")";
209 uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize); 214 return part;
210 uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize);
211 ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")";
212 return part;
213 }
214 } 215 }
215 } 216 }
216 ObjectRegionName = string.Empty; 217 ObjectRegionName = string.Empty;
@@ -363,6 +364,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
363 public Email GetNextEmail(UUID objectID, string sender, string subject) 364 public Email GetNextEmail(UUID objectID, string sender, string subject)
364 { 365 {
365 List<Email> queue = null; 366 List<Email> queue = null;
367 List<UUID> removal = new List<UUID>();
366 368
367 lock (m_LastGetEmailCall) 369 lock (m_LastGetEmailCall)
368 { 370 {
@@ -375,7 +377,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
375 377
376 // Hopefully this isn't too time consuming. If it is, we can always push it into a worker thread. 378 // Hopefully this isn't too time consuming. If it is, we can always push it into a worker thread.
377 DateTime now = DateTime.Now; 379 DateTime now = DateTime.Now;
378 List<UUID> removal = new List<UUID>();
379 foreach (UUID uuid in m_LastGetEmailCall.Keys) 380 foreach (UUID uuid in m_LastGetEmailCall.Keys)
380 { 381 {
381 if ((now - m_LastGetEmailCall[uuid]) > m_QueueTimeout) 382 if ((now - m_LastGetEmailCall[uuid]) > m_QueueTimeout)
@@ -383,15 +384,15 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
383 removal.Add(uuid); 384 removal.Add(uuid);
384 } 385 }
385 } 386 }
387 }
386 388
387 foreach (UUID remove in removal) 389 foreach (UUID remove in removal)
388 { 390 {
391 lock (m_LastGetEmailCall)
389 m_LastGetEmailCall.Remove(remove); 392 m_LastGetEmailCall.Remove(remove);
390 lock (m_MailQueues) 393
391 { 394 lock (m_MailQueues)
392 m_MailQueues.Remove(remove); 395 m_MailQueues.Remove(remove);
393 }
394 }
395 } 396 }
396 397
397 lock (m_MailQueues) 398 lock (m_MailQueues)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index d2b5cb1..0fed1bd 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -187,14 +187,16 @@ namespace OpenSim.Region.CoreModules.World.Land
187 LandData newData = data.Copy(); 187 LandData newData = data.Copy();
188 newData.LocalID = local_id; 188 newData.LocalID = local_id;
189 189
190 ILandObject land = null;
190 lock (m_landList) 191 lock (m_landList)
191 { 192 {
192 if (m_landList.ContainsKey(local_id)) 193 if (m_landList.ContainsKey(local_id))
193 { 194 {
194 m_landList[local_id].LandData = newData; 195 m_landList[local_id].LandData = newData;
195 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); 196 land = m_landList[local_id];
196 } 197 }
197 } 198 }
199 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
198 } 200 }
199 201
200 public bool AllowedForcefulBans 202 public bool AllowedForcefulBans
@@ -504,6 +506,7 @@ namespace OpenSim.Region.CoreModules.World.Land
504 /// <param name="local_id">Land.localID of the peice of land to remove.</param> 506 /// <param name="local_id">Land.localID of the peice of land to remove.</param>
505 public void removeLandObject(int local_id) 507 public void removeLandObject(int local_id)
506 { 508 {
509 UUID id = UUID.Zero;
507 lock (m_landList) 510 lock (m_landList)
508 { 511 {
509 for (int x = 0; x < 64; x++) 512 for (int x = 0; x < 64; x++)
@@ -520,9 +523,10 @@ namespace OpenSim.Region.CoreModules.World.Land
520 } 523 }
521 } 524 }
522 525
523 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID); 526 id = m_landList[local_id].LandData.GlobalID;
524 m_landList.Remove(local_id); 527 m_landList.Remove(local_id);
525 } 528 }
529 m_scene.EventManager.TriggerLandObjectRemoved(id);
526 } 530 }
527 531
528 private void performFinalLandJoin(ILandObject master, ILandObject slave) 532 private void performFinalLandJoin(ILandObject master, ILandObject slave)
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5b571c7..df9473d 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -122,12 +122,13 @@ namespace OpenSim.Region.Framework.Scenes
122 public bool InventoryDeQueueAndDelete() 122 public bool InventoryDeQueueAndDelete()
123 { 123 {
124 DeleteToInventoryHolder x = null; 124 DeleteToInventoryHolder x = null;
125 int left = 0;
125 126
126 try 127 try
127 { 128 {
128 lock (m_inventoryDeletes) 129 lock (m_inventoryDeletes)
129 { 130 {
130 int left = m_inventoryDeletes.Count; 131 left = m_inventoryDeletes.Count;
131 if (left > 0) 132 if (left > 0)
132 { 133 {
133 x = m_inventoryDeletes.Dequeue(); 134 x = m_inventoryDeletes.Dequeue();
@@ -136,23 +137,26 @@ namespace OpenSim.Region.Framework.Scenes
136 m_inventoryDeletes.Enqueue(x); 137 m_inventoryDeletes.Enqueue(x);
137 return true; 138 return true;
138 } 139 }
140 }
141 }
139 142
140 m_log.DebugFormat( 143 if (left > 0)
141 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 144 {
142 145 m_log.DebugFormat(
143 try 146 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
144 { 147
145 m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); 148 try
146 if (x.permissionToDelete) 149 {
147 m_scene.DeleteSceneObject(x.objectGroup, false); 150 m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
148 } 151 if (x.permissionToDelete)
149 catch (Exception e) 152 m_scene.DeleteSceneObject(x.objectGroup, false);
150 { 153 }
151 m_log.DebugFormat("Exception background sending object: " + e); 154 catch (Exception e)
152 } 155 {
153 156 m_log.DebugFormat("Exception background sending object: " + e);
154 return true;
155 } 157 }
158
159 return true;
156 } 160 }
157 } 161 }
158 catch (Exception e) 162 catch (Exception e)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 54ac792..20b3b5c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -297,34 +297,44 @@ namespace OpenSim.Region.Framework.Scenes
297 297
298 sceneObject.AttachToScene(m_parentScene); 298 sceneObject.AttachToScene(m_parentScene);
299 299
300 List<SceneObjectPart> parts = null;
301 bool found = false;
300 lock (sceneObject) 302 lock (sceneObject)
301 { 303 {
302 if (!Entities.ContainsKey(sceneObject.UUID)) 304 if (!Entities.ContainsKey(sceneObject.UUID))
303 { 305 {
306 found = true;
304 Entities.Add(sceneObject); 307 Entities.Add(sceneObject);
305 m_numPrim += sceneObject.Children.Count; 308 m_numPrim += sceneObject.Children.Count;
306 309
307 if (attachToBackup) 310 if (attachToBackup)
308 sceneObject.AttachToBackup(); 311 sceneObject.AttachToBackup();
309 312
310 if (OnObjectCreate != null) 313 parts = new List<SceneObjectPart>(sceneObject.Children.Values);
311 OnObjectCreate(sceneObject); 314
312 315 }
313 lock (m_dictionary_lock) 316 }
317
318 if (found)
319 {
320 lock (m_dictionary_lock)
321 {
322 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
323 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
324 foreach (SceneObjectPart part in parts)
314 { 325 {
315 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 326 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
316 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 327 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
317 foreach (SceneObjectPart part in sceneObject.Children.Values)
318 {
319 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
320 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
321 }
322 } 328 }
323
324 return true;
325 } 329 }
330
331 if (OnObjectCreate != null)
332 OnObjectCreate(sceneObject);
333
334 return true;
326 } 335 }
327 336
337
328 return false; 338 return false;
329 } 339 }
330 340
diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
index 8798c5e..23d8593 100644
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ b/OpenSim/Tests/Clients/Grid/GridClient.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Tests.Clients.GridClient
55 new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"); 55 new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
56 log4net.Config.BasicConfigurator.Configure(consoleAppender); 56 log4net.Config.BasicConfigurator.Configure(consoleAppender);
57 57
58 string serverURI = "http://127.0.0.1:8001"; 58 string serverURI = "http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort;
59 GridServicesConnector m_Connector = new GridServicesConnector(serverURI); 59 GridServicesConnector m_Connector = new GridServicesConnector(serverURI);
60 60
61 GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000); 61 GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000);