aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs47
1 files changed, 28 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 7d8ae57..e740fe8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
52 52
53 private IGridService m_GridService; 53 private IGridService m_GridService;
54 private RegionInfoCache m_RegionInfoCache; 54 private RegionInfoCache m_RegionInfoCache;
55 private HashSet<Scene> m_scenes = new HashSet<Scene>();
55 56
56 private bool m_Enabled; 57 private bool m_Enabled;
57 58
@@ -68,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
68 69
69 public LocalGridServicesConnector(IConfigSource source, RegionInfoCache regionInfoCache) 70 public LocalGridServicesConnector(IConfigSource source, RegionInfoCache regionInfoCache)
70 { 71 {
71 m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly witj cache.", LogHeader); 72 m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly with cache.", LogHeader);
72 InitialiseService(source, regionInfoCache); 73 InitialiseService(source, regionInfoCache);
73 } 74 }
74 75
@@ -153,6 +154,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
153 if (!m_Enabled) 154 if (!m_Enabled)
154 return; 155 return;
155 156
157 lock(m_scenes)
158 {
159 if(!m_scenes.Contains(scene))
160 m_scenes.Add(scene);
161 }
156 scene.RegisterModuleInterface<IGridService>(this); 162 scene.RegisterModuleInterface<IGridService>(this);
157 163
158 GridRegion r = new GridRegion(scene.RegionInfo); 164 GridRegion r = new GridRegion(scene.RegionInfo);
@@ -166,6 +172,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
166 if (!m_Enabled) 172 if (!m_Enabled)
167 return; 173 return;
168 174
175 lock(m_scenes)
176 {
177 if(m_scenes.Contains(scene))
178 m_scenes.Remove(scene);
179 }
180
169 m_RegionInfoCache.Remove(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionHandle); 181 m_RegionInfoCache.Remove(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionHandle);
170 scene.EventManager.OnRegionUp -= OnRegionUp; 182 scene.EventManager.OnRegionUp -= OnRegionUp;
171 } 183 }
@@ -221,14 +233,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
221 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 233 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
222 { 234 {
223 235
224 // try in cache by handler first
225// ulong regionHandle = Util.RegionWorldLocToHandle((uint)x, (uint)y);
226
227 bool inCache = false; 236 bool inCache = false;
228// GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache);
229// if (inCache)
230// return rinfo;
231
232 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, (uint)x, (uint)y, out inCache); 237 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, (uint)x, (uint)y, out inCache);
233 if (inCache) 238 if (inCache)
234 return rinfo; 239 return rinfo;
@@ -297,22 +302,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
297 302
298 public void HandleShowNeighboursCommand(string module, string[] cmdparams) 303 public void HandleShowNeighboursCommand(string module, string[] cmdparams)
299 { 304 {
305 if(!m_Enabled || m_scenes.Count == 0)
306 return;
307
300 System.Text.StringBuilder caps = new System.Text.StringBuilder(); 308 System.Text.StringBuilder caps = new System.Text.StringBuilder();
301/* temporary broken 309
302 lock (m_LocalCache) 310 List<Scene> scenes;
311 lock (m_scenes)
312 scenes = new List<Scene>(m_scenes);
313
314 foreach (Scene s in scenes)
303 { 315 {
304 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache) 316 RegionInfo sr = s.RegionInfo;
305 { 317 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", sr.RegionName, sr.RegionID);
306 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); 318 List<GridRegion> regions = GetNeighbours(sr.ScopeID, sr.RegionID);
307 List<GridRegion> regions = kvp.Value.GetNeighbours(); 319 foreach (GridRegion r in regions)
308 foreach (GridRegion r in regions) 320 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
309 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
310 }
311 } 321 }
312 322
313 MainConsole.Instance.Output(caps.ToString()); 323 MainConsole.Instance.Output(caps.ToString());
314*/ 324
315 MainConsole.Instance.Output("Neighbours list not avaiable in this version\n");
316 } 325 }
317 } 326 }
318} 327}