aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs43
1 files changed, 28 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index c0c2ca7..c32820e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -142,10 +142,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
142 142
143 scene.RegisterModuleInterface<IGridService>(this); 143 scene.RegisterModuleInterface<IGridService>(this);
144 144
145 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) 145 lock (m_LocalCache)
146 m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); 146 {
147 else 147 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
148 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); 148 m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
149 else
150 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
151 }
149 } 152 }
150 153
151 public void RemoveRegion(Scene scene) 154 public void RemoveRegion(Scene scene)
@@ -153,8 +156,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
153 if (!m_Enabled) 156 if (!m_Enabled)
154 return; 157 return;
155 158
156 m_LocalCache[scene.RegionInfo.RegionID].Clear(); 159 lock (m_LocalCache)
157 m_LocalCache.Remove(scene.RegionInfo.RegionID); 160 {
161 m_LocalCache[scene.RegionInfo.RegionID].Clear();
162 m_LocalCache.Remove(scene.RegionInfo.RegionID);
163 }
158 } 164 }
159 165
160 public void RegionLoaded(Scene scene) 166 public void RegionLoaded(Scene scene)
@@ -191,12 +197,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
191 197
192 // First see if it's a neighbour, even if it isn't on this sim. 198 // First see if it's a neighbour, even if it isn't on this sim.
193 // Neighbour data is cached in memory, so this is fast 199 // Neighbour data is cached in memory, so this is fast
194 foreach (RegionCache rcache in m_LocalCache.Values) 200
201 lock (m_LocalCache)
195 { 202 {
196 region = rcache.GetRegionByPosition(x, y); 203 foreach (RegionCache rcache in m_LocalCache.Values)
197 if (region != null)
198 { 204 {
199 return region; 205 region = rcache.GetRegionByPosition(x, y);
206 if (region != null)
207 {
208 return region;
209 }
200 } 210 }
201 } 211 }
202 212
@@ -245,12 +255,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
245 { 255 {
246 System.Text.StringBuilder caps = new System.Text.StringBuilder(); 256 System.Text.StringBuilder caps = new System.Text.StringBuilder();
247 257
248 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache) 258 lock (m_LocalCache)
249 { 259 {
250 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); 260 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
251 List<GridRegion> regions = kvp.Value.GetNeighbours(); 261 {
252 foreach (GridRegion r in regions) 262 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
253 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 263 List<GridRegion> regions = kvp.Value.GetNeighbours();
264 foreach (GridRegion r in regions)
265 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
266 }
254 } 267 }
255 268
256 MainConsole.Instance.Output(caps.ToString()); 269 MainConsole.Instance.Output(caps.ToString());