diff options
Diffstat (limited to 'OpenSim/Services/GridService/HypergridLinker.cs')
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 12ea453..c539047 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -65,6 +65,8 @@ namespace OpenSim.Services.GridService | |||
65 | protected UUID m_ScopeID = UUID.Zero; | 65 | protected UUID m_ScopeID = UUID.Zero; |
66 | protected bool m_Check4096 = true; | 66 | protected bool m_Check4096 = true; |
67 | protected string m_MapTileDirectory = string.Empty; | 67 | protected string m_MapTileDirectory = string.Empty; |
68 | protected string m_ThisGatekeeper = string.Empty; | ||
69 | protected Uri m_ThisGatekeeperURI = null; | ||
68 | 70 | ||
69 | // Hyperlink regions are hyperlinks on the map | 71 | // Hyperlink regions are hyperlinks on the map |
70 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); | 72 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); |
@@ -123,6 +125,16 @@ namespace OpenSim.Services.GridService | |||
123 | 125 | ||
124 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); | 126 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); |
125 | 127 | ||
128 | m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); | ||
129 | try | ||
130 | { | ||
131 | m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); | ||
132 | } | ||
133 | catch | ||
134 | { | ||
135 | m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); | ||
136 | } | ||
137 | |||
126 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); | 138 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); |
127 | 139 | ||
128 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); | 140 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); |
@@ -246,6 +258,8 @@ namespace OpenSim.Services.GridService | |||
246 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); | 258 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); |
247 | 259 | ||
248 | reason = string.Empty; | 260 | reason = string.Empty; |
261 | Uri uri = null; | ||
262 | |||
249 | regInfo = new GridRegion(); | 263 | regInfo = new GridRegion(); |
250 | if ( externalPort > 0) | 264 | if ( externalPort > 0) |
251 | regInfo.HttpPort = externalPort; | 265 | regInfo.HttpPort = externalPort; |
@@ -256,8 +270,17 @@ namespace OpenSim.Services.GridService | |||
256 | else | 270 | else |
257 | regInfo.ExternalHostName = "0.0.0.0"; | 271 | regInfo.ExternalHostName = "0.0.0.0"; |
258 | if ( serverURI != null) | 272 | if ( serverURI != null) |
273 | { | ||
259 | regInfo.ServerURI = serverURI; | 274 | regInfo.ServerURI = serverURI; |
260 | 275 | try | |
276 | { | ||
277 | uri = new Uri(serverURI); | ||
278 | regInfo.ExternalHostName = uri.Host; | ||
279 | regInfo.HttpPort = (uint)uri.Port; | ||
280 | } | ||
281 | catch {} | ||
282 | } | ||
283 | |||
261 | if ( remoteRegionName != string.Empty ) | 284 | if ( remoteRegionName != string.Empty ) |
262 | regInfo.RegionName = remoteRegionName; | 285 | regInfo.RegionName = remoteRegionName; |
263 | 286 | ||
@@ -266,6 +289,18 @@ namespace OpenSim.Services.GridService | |||
266 | regInfo.ScopeID = scopeID; | 289 | regInfo.ScopeID = scopeID; |
267 | regInfo.EstateOwner = ownerID; | 290 | regInfo.EstateOwner = ownerID; |
268 | 291 | ||
292 | // Make sure we're not hyperlinking to regions on this grid! | ||
293 | if (m_ThisGatekeeperURI != null) | ||
294 | { | ||
295 | if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) | ||
296 | { | ||
297 | reason = "Cannot hyperlink to regions on the same grid"; | ||
298 | return false; | ||
299 | } | ||
300 | } | ||
301 | else | ||
302 | m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!"); | ||
303 | |||
269 | // Check for free coordinates | 304 | // Check for free coordinates |
270 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | 305 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); |
271 | if (region != null) | 306 | if (region != null) |