diff options
author | Diva Canto | 2010-05-03 09:50:55 -0700 |
---|---|---|
committer | Diva Canto | 2010-05-03 09:50:55 -0700 |
commit | b10811a13b8fab81ce00d544d8efe081792bdaaa (patch) | |
tree | d91da884fa1f43a11067f7adda2f398d3b9bf77a /OpenSim/Services/GridService | |
parent | Fix a bug in owner change notification (diff) | |
download | opensim-SC-b10811a13b8fab81ce00d544d8efe081792bdaaa.zip opensim-SC-b10811a13b8fab81ce00d544d8efe081792bdaaa.tar.gz opensim-SC-b10811a13b8fab81ce00d544d8efe081792bdaaa.tar.bz2 opensim-SC-b10811a13b8fab81ce00d544d8efe081792bdaaa.tar.xz |
Assorted bug fixes in hypergrid linking.
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 5 | ||||
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 52 |
2 files changed, 33 insertions, 24 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 2faf018..4089fce 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -315,6 +315,8 @@ namespace OpenSim.Services.GridService | |||
315 | 315 | ||
316 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) | 316 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) |
317 | { | 317 | { |
318 | m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); | ||
319 | |||
318 | List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID); | 320 | List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID); |
319 | 321 | ||
320 | int count = 0; | 322 | int count = 0; |
@@ -329,7 +331,7 @@ namespace OpenSim.Services.GridService | |||
329 | } | 331 | } |
330 | } | 332 | } |
331 | 333 | ||
332 | if (m_AllowHypergridMapSearch && rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")) | 334 | if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains("."))) |
333 | { | 335 | { |
334 | GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); | 336 | GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); |
335 | if (r != null) | 337 | if (r != null) |
@@ -397,6 +399,7 @@ namespace OpenSim.Services.GridService | |||
397 | ret.Add(RegionData2RegionInfo(r)); | 399 | ret.Add(RegionData2RegionInfo(r)); |
398 | } | 400 | } |
399 | 401 | ||
402 | m_log.DebugFormat("[GRID SERVICE]: GetDefaultRegions returning {0} regions", ret.Count); | ||
400 | return ret; | 403 | return ret; |
401 | } | 404 | } |
402 | 405 | ||
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 58746d0..af603b2 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -79,9 +79,16 @@ namespace OpenSim.Services.GridService | |||
79 | m_DefaultRegion = defs[0]; | 79 | m_DefaultRegion = defs[0]; |
80 | else | 80 | else |
81 | { | 81 | { |
82 | // Best guess, may be totally off | 82 | // Get any region |
83 | m_DefaultRegion = new GridRegion(1000, 1000); | 83 | defs = m_GridService.GetRegionsByName(m_ScopeID, "", 1); |
84 | m_log.WarnFormat("[HYPERGRID LINKER]: This grid does not have a default region. Assuming default coordinates at 1000, 1000."); | 84 | if (defs != null && defs.Count > 0) |
85 | m_DefaultRegion = defs[0]; | ||
86 | else | ||
87 | { | ||
88 | // This shouldn't happen | ||
89 | m_DefaultRegion = new GridRegion(1000, 1000); | ||
90 | m_log.Error("[HYPERGRID LINKER]: Something is wrong with this grid. It has no regions?"); | ||
91 | } | ||
85 | } | 92 | } |
86 | } | 93 | } |
87 | return m_DefaultRegion; | 94 | return m_DefaultRegion; |
@@ -90,7 +97,7 @@ namespace OpenSim.Services.GridService | |||
90 | 97 | ||
91 | public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) | 98 | public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) |
92 | { | 99 | { |
93 | m_log.DebugFormat("[HYPERGRID LINKER]: Starting..."); | 100 | m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); |
94 | 101 | ||
95 | m_Database = db; | 102 | m_Database = db; |
96 | m_GridService = gridService; | 103 | m_GridService = gridService; |
@@ -196,7 +203,7 @@ namespace OpenSim.Services.GridService | |||
196 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, | 203 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, |
197 | string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) | 204 | string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) |
198 | { | 205 | { |
199 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); | 206 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); |
200 | 207 | ||
201 | reason = string.Empty; | 208 | reason = string.Empty; |
202 | regInfo = new GridRegion(); | 209 | regInfo = new GridRegion(); |
@@ -280,29 +287,28 @@ namespace OpenSim.Services.GridService | |||
280 | 287 | ||
281 | public bool TryUnlinkRegion(string mapName) | 288 | public bool TryUnlinkRegion(string mapName) |
282 | { | 289 | { |
290 | m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName); | ||
283 | GridRegion regInfo = null; | 291 | GridRegion regInfo = null; |
284 | if (mapName.Contains(":")) | 292 | |
293 | List<RegionData> regions = m_Database.Get(mapName, m_ScopeID); | ||
294 | if (regions != null && regions.Count > 0) | ||
285 | { | 295 | { |
286 | string host = "127.0.0.1"; | 296 | OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); |
287 | //string portstr; | 297 | if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) |
288 | //string regionName = ""; | ||
289 | uint port = 9000; | ||
290 | string[] parts = mapName.Split(new char[] { ':' }); | ||
291 | if (parts.Length >= 1) | ||
292 | { | 298 | { |
293 | host = parts[0]; | 299 | regInfo = new GridRegion(); |
300 | regInfo.RegionID = regions[0].RegionID; | ||
301 | regInfo.ScopeID = m_ScopeID; | ||
294 | } | 302 | } |
295 | |||
296 | foreach (GridRegion r in m_HyperlinkRegions.Values) | ||
297 | if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) | ||
298 | regInfo = r; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | foreach (GridRegion r in m_HyperlinkRegions.Values) | ||
303 | if (r.RegionName.Equals(mapName)) | ||
304 | regInfo = r; | ||
305 | } | 303 | } |
304 | |||
305 | //foreach (GridRegion r in m_HyperlinkRegions.Values) | ||
306 | //{ | ||
307 | // m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort); | ||
308 | // if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) | ||
309 | // regInfo = r; | ||
310 | //} | ||
311 | |||
306 | if (regInfo != null) | 312 | if (regInfo != null) |
307 | { | 313 | { |
308 | RemoveHyperlinkRegion(regInfo.RegionID); | 314 | RemoveHyperlinkRegion(regInfo.RegionID); |