aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
authorMelanie2010-05-03 21:25:40 +0100
committerMelanie2010-05-03 21:25:40 +0100
commitf61b879f2dd23470fe8e51a1f2d14c62b90043d4 (patch)
tree101882581a70b93fddd80049acbb8fef4ebe69ab /OpenSim/Services/GridService/HypergridLinker.cs
parentStore given items in correct parent folder. Fixes items given to offline avatars (diff)
parentAssorted bug fixes in hypergrid linking. (diff)
downloadopensim-SC_OLD-f61b879f2dd23470fe8e51a1f2d14c62b90043d4.zip
opensim-SC_OLD-f61b879f2dd23470fe8e51a1f2d14c62b90043d4.tar.gz
opensim-SC_OLD-f61b879f2dd23470fe8e51a1f2d14c62b90043d4.tar.bz2
opensim-SC_OLD-f61b879f2dd23470fe8e51a1f2d14c62b90043d4.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Services/GridService/HypergridLinker.cs')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs52
1 files changed, 29 insertions, 23 deletions
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);