From 0db60eea85f16b0b428190590b8e8ca1392a2e35 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 19 May 2012 04:59:36 +0100
Subject: Improve locking of RegionCombinerModule.m_regions
---
.../RegionCombinerModule/RegionCombinerModule.cs | 53 ++++++++++++----------
1 file changed, 29 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Region')
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
}
///
+ /// Is this module enabled?
+ ///
+ private bool enabledYN = false;
+
+ ///
/// This holds the root regions for the megaregions.
///
///
@@ -67,11 +72,6 @@ namespace OpenSim.Region.RegionCombinerModule
private Dictionary m_regions = new Dictionary();
///
- /// Is this module enabled?
- ///
- private bool enabledYN = false;
-
- ///
/// The scenes that comprise the megaregion.
///
private Dictionary m_startingScenes = new Dictionary();
@@ -717,16 +717,16 @@ namespace OpenSim.Region.RegionCombinerModule
{
ForwardPermissionRequests(rootConn, r.RegionScene);
}
- }
-
- // Create the root region's Client Event Forwarder
- rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
-
- // Sets up the CoarseLocationUpdate forwarder for this root region
- scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
- // Adds this root region to a dictionary of regions that are connectable
- m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
+ // Create the root region's Client Event Forwarder
+ rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn);
+
+ // Sets up the CoarseLocationUpdate forwarder for this root region
+ scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
+
+ // Adds this root region to a dictionary of regions that are connectable
+ m_regions.Add(scene.RegionInfo.originRegionID, rootConn);
+ }
}
private void SetCourseLocationDelegate(ScenePresence presence)
@@ -983,6 +983,7 @@ namespace OpenSim.Region.RegionCombinerModule
return true;
}
}
+
oborder = null;
return false;
}
@@ -992,14 +993,19 @@ namespace OpenSim.Region.RegionCombinerModule
pPosition = pPosition/(int) Constants.RegionSize;
int OffsetX = (int) pPosition.X;
int OffsetY = (int) pPosition.Y;
- foreach (RegionConnections regConn in m_regions.Values)
+
+ lock (m_regions)
{
- foreach (RegionData reg in regConn.ConnectedRegions)
+ foreach (RegionConnections regConn in m_regions.Values)
{
- if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
- return reg;
+ foreach (RegionData reg in regConn.ConnectedRegions)
+ {
+ if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
+ return reg;
+ }
}
}
+
return new RegionData();
}
@@ -1055,18 +1061,17 @@ namespace OpenSim.Region.RegionCombinerModule
}
#region console commands
+
public void FixPhantoms(string module, string[] cmdparams)
{
- List scenes = new List(m_startingScenes.Values);
+ List scenes = new List(m_startingScenes.Values);
+
foreach (Scene s in scenes)
{
- s.ForEachSOG(delegate(SceneObjectGroup e)
- {
- e.AbsolutePosition = e.AbsolutePosition;
- }
- );
+ s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition);
}
}
+
#endregion
}
}
--
cgit v1.1