From 7c00469cd210cfdda3dd835867469159d4c8b9d9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Jan 2010 08:00:29 -0800 Subject: Added ExternalName config on Gatekeeper. --- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 7 ++++--- OpenSim/Services/GridService/HypergridLinker.cs | 18 +++++++++++++++--- OpenSim/Services/HypergridService/GatekeeperService.cs | 5 ++++- OpenSim/Services/Interfaces/IGatekeeperService.cs | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index ae0a0b6..5ad1af2 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -45,11 +45,12 @@ namespace OpenSim.Services.Connectors.Hypergrid return "/foreignobject/"; } - public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason) + public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; imageURL = string.Empty; realHandle = 0; + externalName = string.Empty; reason = string.Empty; Hashtable hash = new Hashtable(); @@ -97,9 +98,9 @@ namespace OpenSim.Services.Connectors.Hypergrid //m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) - { imageURL = (string)hash["region_image"]; - } + if (hash["external_name"] != null) + externalName = (string)hash["external_name"]; } } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 1289cf6..cda7dae 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -214,8 +214,9 @@ namespace OpenSim.Services.GridService // Finally, link it ulong handle = 0; UUID regionID = UUID.Zero; + string externalName = string.Empty; string imageURL = string.Empty; - if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out imageURL, out reason)) + if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) return false; if (regionID != UUID.Zero) @@ -229,11 +230,22 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; + Uri uri = null; + try + { + uri = new Uri(externalName); + regInfo.ExternalHostName = uri.Host; + regInfo.HttpPort = (uint)uri.Port; + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); + } regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; // Try get the map image - regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); + //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working - //regInfo.TerrainImage = m_HGMapImage; + regInfo.TerrainImage = m_HGMapImage; AddHyperlinkRegion(regInfo, handle); m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 283ab3e..3cb5d50 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -59,6 +59,7 @@ namespace OpenSim.Services.HypergridService UUID m_ScopeID; bool m_AllowTeleportsToAnyRegion; + string m_ExternalName; GridRegion m_DefaultGatewayRegion; public GatekeeperService(IConfigSource config, ISimulationService simService) @@ -83,6 +84,7 @@ namespace OpenSim.Services.HypergridService UUID.TryParse(scope, out m_ScopeID); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); + m_ExternalName = serverConfig.GetString("ExternalName", string.Empty); Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); @@ -109,10 +111,11 @@ namespace OpenSim.Services.HypergridService { } - public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) + public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; regionHandle = 0; + externalName = m_ExternalName; imageURL = string.Empty; reason = string.Empty; diff --git a/OpenSim/Services/Interfaces/IGatekeeperService.cs b/OpenSim/Services/Interfaces/IGatekeeperService.cs index 5b5c9d1..f8eb817 100644 --- a/OpenSim/Services/Interfaces/IGatekeeperService.cs +++ b/OpenSim/Services/Interfaces/IGatekeeperService.cs @@ -36,7 +36,7 @@ namespace OpenSim.Services.Interfaces { public interface IGatekeeperService { - bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason); + bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); GridRegion GetHyperlinkRegion(UUID regionID); bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); -- cgit v1.1