diff options
author | Oren Hurvitz | 2012-08-09 14:51:05 +0300 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-02 22:28:41 +0000 |
commit | 9784e4e07db63a23897876dfbd27974878d5eca9 (patch) | |
tree | 07a56bc67cc6f6097217e05b62d7428cad9bb96f /OpenSim/Region/CoreModules/World/Land | |
parent | If Save OAR/IAR times-out while waiting for assets then notify the caller tha... (diff) | |
download | opensim-SC-9784e4e07db63a23897876dfbd27974878d5eca9.zip opensim-SC-9784e4e07db63a23897876dfbd27974878d5eca9.tar.gz opensim-SC-9784e4e07db63a23897876dfbd27974878d5eca9.tar.bz2 opensim-SC-9784e4e07db63a23897876dfbd27974878d5eca9.tar.xz |
Changed locks to prevent deadlocks (especially during multi-region Load OAR)
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 11 |
2 files changed, 34 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index e85b7a2..4b1e6b9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -287,14 +287,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
287 | LandData newData = data.Copy(); | 287 | LandData newData = data.Copy(); |
288 | newData.LocalID = local_id; | 288 | newData.LocalID = local_id; |
289 | 289 | ||
290 | ILandObject land; | ||
290 | lock (m_landList) | 291 | lock (m_landList) |
291 | { | 292 | { |
292 | if (m_landList.ContainsKey(local_id)) | 293 | if (m_landList.TryGetValue(local_id, out land)) |
293 | { | 294 | land.LandData = newData; |
294 | m_landList[local_id].LandData = newData; | ||
295 | m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); | ||
296 | } | ||
297 | } | 295 | } |
296 | |||
297 | if (land != null) | ||
298 | m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land); | ||
298 | } | 299 | } |
299 | 300 | ||
300 | public bool AllowedForcefulBans | 301 | public bool AllowedForcefulBans |
@@ -613,7 +614,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
613 | // Only now can we add the prim counts to the land object - we rely on the global ID which is generated | 614 | // Only now can we add the prim counts to the land object - we rely on the global ID which is generated |
614 | // as a random UUID inside LandData initialization | 615 | // as a random UUID inside LandData initialization |
615 | if (m_primCountModule != null) | 616 | if (m_primCountModule != null) |
616 | new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); | 617 | new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); |
617 | 618 | ||
618 | lock (m_landList) | 619 | lock (m_landList) |
619 | { | 620 | { |
@@ -650,6 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
650 | /// <param name="local_id">Land.localID of the peice of land to remove.</param> | 651 | /// <param name="local_id">Land.localID of the peice of land to remove.</param> |
651 | public void removeLandObject(int local_id) | 652 | public void removeLandObject(int local_id) |
652 | { | 653 | { |
654 | ILandObject land; | ||
653 | lock (m_landList) | 655 | lock (m_landList) |
654 | { | 656 | { |
655 | for (int x = 0; x < 64; x++) | 657 | for (int x = 0; x < 64; x++) |
@@ -666,9 +668,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
666 | } | 668 | } |
667 | } | 669 | } |
668 | 670 | ||
669 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID); | 671 | land = m_landList[local_id]; |
670 | m_landList.Remove(local_id); | 672 | m_landList.Remove(local_id); |
671 | } | 673 | } |
674 | |||
675 | m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); | ||
672 | } | 676 | } |
673 | 677 | ||
674 | /// <summary> | 678 | /// <summary> |
@@ -676,21 +680,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
676 | /// </summary> | 680 | /// </summary> |
677 | public void Clear(bool setupDefaultParcel) | 681 | public void Clear(bool setupDefaultParcel) |
678 | { | 682 | { |
683 | List<ILandObject> parcels; | ||
679 | lock (m_landList) | 684 | lock (m_landList) |
680 | { | 685 | { |
681 | foreach (ILandObject lo in m_landList.Values) | 686 | parcels = new List<ILandObject>(m_landList.Values); |
682 | { | 687 | } |
683 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | 688 | |
684 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | 689 | foreach (ILandObject lo in parcels) |
685 | } | 690 | { |
691 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | ||
692 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | ||
693 | } | ||
686 | 694 | ||
695 | lock (m_landList) | ||
696 | { | ||
687 | m_landList.Clear(); | 697 | m_landList.Clear(); |
688 | 698 | ||
689 | ResetSimLandObjects(); | 699 | ResetSimLandObjects(); |
690 | |||
691 | if (setupDefaultParcel) | ||
692 | CreateDefaultParcel(); | ||
693 | } | 700 | } |
701 | |||
702 | if (setupDefaultParcel) | ||
703 | CreateDefaultParcel(); | ||
694 | } | 704 | } |
695 | 705 | ||
696 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 706 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
@@ -1458,11 +1468,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1458 | 1468 | ||
1459 | public void EventManagerOnNoLandDataFromStorage() | 1469 | public void EventManagerOnNoLandDataFromStorage() |
1460 | { | 1470 | { |
1461 | lock (m_landList) | 1471 | ResetSimLandObjects(); |
1462 | { | 1472 | CreateDefaultParcel(); |
1463 | ResetSimLandObjects(); | ||
1464 | CreateDefaultParcel(); | ||
1465 | } | ||
1466 | } | 1473 | } |
1467 | 1474 | ||
1468 | #endregion | 1475 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index f9cc0cf..9b51cc8 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -490,11 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
490 | 490 | ||
491 | m_Scene.ForEachSOG(AddObject); | 491 | m_Scene.ForEachSOG(AddObject); |
492 | 492 | ||
493 | List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys); | 493 | lock (m_PrimCounts) |
494 | foreach (UUID k in primcountKeys) | ||
495 | { | 494 | { |
496 | if (!m_OwnerMap.ContainsKey(k)) | 495 | List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys); |
497 | m_PrimCounts.Remove(k); | 496 | foreach (UUID k in primcountKeys) |
497 | { | ||
498 | if (!m_OwnerMap.ContainsKey(k)) | ||
499 | m_PrimCounts.Remove(k); | ||
500 | } | ||
498 | } | 501 | } |
499 | 502 | ||
500 | m_Tainted = false; | 503 | m_Tainted = false; |