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 a4aa44d..b226971 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..."); |
@@ -210,6 +222,8 @@ namespace OpenSim.Services.GridService | |||
210 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); | 222 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); |
211 | 223 | ||
212 | reason = string.Empty; | 224 | reason = string.Empty; |
225 | Uri uri = null; | ||
226 | |||
213 | regInfo = new GridRegion(); | 227 | regInfo = new GridRegion(); |
214 | if ( externalPort > 0) | 228 | if ( externalPort > 0) |
215 | regInfo.HttpPort = externalPort; | 229 | regInfo.HttpPort = externalPort; |
@@ -220,8 +234,17 @@ namespace OpenSim.Services.GridService | |||
220 | else | 234 | else |
221 | regInfo.ExternalHostName = "0.0.0.0"; | 235 | regInfo.ExternalHostName = "0.0.0.0"; |
222 | if ( serverURI != null) | 236 | if ( serverURI != null) |
237 | { | ||
223 | regInfo.ServerURI = serverURI; | 238 | regInfo.ServerURI = serverURI; |
224 | 239 | try | |
240 | { | ||
241 | uri = new Uri(serverURI); | ||
242 | regInfo.ExternalHostName = uri.Host; | ||
243 | regInfo.HttpPort = (uint)uri.Port; | ||
244 | } | ||
245 | catch {} | ||
246 | } | ||
247 | |||
225 | if ( remoteRegionName != string.Empty ) | 248 | if ( remoteRegionName != string.Empty ) |
226 | regInfo.RegionName = remoteRegionName; | 249 | regInfo.RegionName = remoteRegionName; |
227 | 250 | ||
@@ -230,6 +253,18 @@ namespace OpenSim.Services.GridService | |||
230 | regInfo.ScopeID = scopeID; | 253 | regInfo.ScopeID = scopeID; |
231 | regInfo.EstateOwner = ownerID; | 254 | regInfo.EstateOwner = ownerID; |
232 | 255 | ||
256 | // Make sure we're not hyperlinking to regions on this grid! | ||
257 | if (m_ThisGatekeeperURI != null) | ||
258 | { | ||
259 | if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) | ||
260 | { | ||
261 | reason = "Cannot hyperlink to regions on the same grid"; | ||
262 | return false; | ||
263 | } | ||
264 | } | ||
265 | else | ||
266 | m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!"); | ||
267 | |||
233 | // Check for free coordinates | 268 | // Check for free coordinates |
234 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | 269 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); |
235 | if (region != null) | 270 | if (region != null) |