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/Scripting | |
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/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | 37 |
1 files changed, 19 insertions, 18 deletions
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) |