aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-19 04:59:36 +0100
committerJustin Clark-Casey (justincc)2012-05-19 04:59:36 +0100
commit0db60eea85f16b0b428190590b8e8ca1392a2e35 (patch)
tree208c08c0fdbc1c92d0473d2b9b69d251d57522fb /OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
parentAdd size of region to OAR control file. Megaregions (sw root OARs when saved... (diff)
downloadopensim-SC_OLD-0db60eea85f16b0b428190590b8e8ca1392a2e35.zip
opensim-SC_OLD-0db60eea85f16b0b428190590b8e8ca1392a2e35.tar.gz
opensim-SC_OLD-0db60eea85f16b0b428190590b8e8ca1392a2e35.tar.bz2
opensim-SC_OLD-0db60eea85f16b0b428190590b8e8ca1392a2e35.tar.xz
Improve locking of RegionCombinerModule.m_regions
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs53
1 files changed, 29 insertions, 24 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 98becce..40daf13 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -59,6 +59,11 @@ namespace OpenSim.Region.RegionCombinerModule
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// Is this module enabled?
63 /// </summary>
64 private bool enabledYN = false;
65
66 /// <summary>
62 /// This holds the root regions for the megaregions. 67 /// This holds the root regions for the megaregions.
63 /// </summary> 68 /// </summary>
64 /// <remarks> 69 /// <remarks>
@@ -67,11 +72,6 @@ namespace OpenSim.Region.RegionCombinerModule
67 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>(); 72 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
68 73
69 /// <summary> 74 /// <summary>
70 /// Is this module enabled?
71 /// </summary>
72 private bool enabledYN = false;
73
74 /// <summary>
75 /// The scenes that comprise the megaregion. 75 /// The scenes that comprise the megaregion.
76 /// </summary> 76 /// </summary>
77 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>(); 77 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
@@ -717,16 +717,16 @@ namespace OpenSim.Region.RegionCombinerModule
717 { 717 {
718 ForwardPermissionRequests(rootConn, r.RegionScene); 718 ForwardPermissionRequests(rootConn, r.RegionScene);
719 } 719 }
720 }
721
722 // Create the root region's Client Event Forwarder
723 rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
724
725 // Sets up the CoarseLocationUpdate forwarder for this root region
726 scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
727 720
728 // Adds this root region to a dictionary of regions that are connectable 721 // Create the root region's Client Event Forwarder
729 m_regions.Add(scene.RegionInfo.originRegionID, rootConn); 722 rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
723
724 // Sets up the CoarseLocationUpdate forwarder for this root region
725 scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
726
727 // Adds this root region to a dictionary of regions that are connectable
728 m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
729 }
730 } 730 }
731 731
732 private void SetCourseLocationDelegate(ScenePresence presence) 732 private void SetCourseLocationDelegate(ScenePresence presence)
@@ -983,6 +983,7 @@ namespace OpenSim.Region.RegionCombinerModule
983 return true; 983 return true;
984 } 984 }
985 } 985 }
986
986 oborder = null; 987 oborder = null;
987 return false; 988 return false;
988 } 989 }
@@ -992,14 +993,19 @@ namespace OpenSim.Region.RegionCombinerModule
992 pPosition = pPosition/(int) Constants.RegionSize; 993 pPosition = pPosition/(int) Constants.RegionSize;
993 int OffsetX = (int) pPosition.X; 994 int OffsetX = (int) pPosition.X;
994 int OffsetY = (int) pPosition.Y; 995 int OffsetY = (int) pPosition.Y;
995 foreach (RegionConnections regConn in m_regions.Values) 996
997 lock (m_regions)
996 { 998 {
997 foreach (RegionData reg in regConn.ConnectedRegions) 999 foreach (RegionConnections regConn in m_regions.Values)
998 { 1000 {
999 if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY) 1001 foreach (RegionData reg in regConn.ConnectedRegions)
1000 return reg; 1002 {
1003 if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
1004 return reg;
1005 }
1001 } 1006 }
1002 } 1007 }
1008
1003 return new RegionData(); 1009 return new RegionData();
1004 } 1010 }
1005 1011
@@ -1055,18 +1061,17 @@ namespace OpenSim.Region.RegionCombinerModule
1055 } 1061 }
1056 1062
1057 #region console commands 1063 #region console commands
1064
1058 public void FixPhantoms(string module, string[] cmdparams) 1065 public void FixPhantoms(string module, string[] cmdparams)
1059 { 1066 {
1060 List<Scene> scenes = new List<Scene>(m_startingScenes.Values); 1067 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
1068
1061 foreach (Scene s in scenes) 1069 foreach (Scene s in scenes)
1062 { 1070 {
1063 s.ForEachSOG(delegate(SceneObjectGroup e) 1071 s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
1064 {
1065 e.AbsolutePosition = e.AbsolutePosition;
1066 }
1067 );
1068 } 1072 }
1069 } 1073 }
1074
1070 #endregion 1075 #endregion
1071 } 1076 }
1072} 1077}