From 6d2893be67fd725090b69f5f31c0985c3d211135 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 3 Apr 2014 12:47:20 +0300 Subject: When teleporting using Hypergrid, show more informative error messages in case of error --- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 13 ++++++++++++- OpenSim/Services/HypergridService/GatekeeperService.cs | 13 ++++++++++++- OpenSim/Services/Interfaces/IHypergridServices.cs | 2 +- OpenSim/Services/LLLoginService/LLLoginService.cs | 3 ++- 4 files changed, 27 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 5d7dcfd..8b1cc27 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -202,7 +202,7 @@ namespace OpenSim.Services.Connectors.Hypergrid return mapTile; } - public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) + public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID, out string message) { Hashtable hash = new Hashtable(); hash["region_uuid"] = regionID.ToString(); @@ -219,12 +219,14 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { + message = "Error contacting grid."; m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } if (response.IsFault) { + message = "Error contacting grid."; m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); return null; } @@ -236,6 +238,14 @@ namespace OpenSim.Services.Connectors.Hypergrid { bool success = false; Boolean.TryParse((string)hash["result"], out success); + + if (hash["message"] != null) + message = (string)hash["message"]; + else if (success) + message = null; + else + message = "The teleport destination could not be found."; // probably the dest grid is old and doesn't send 'message', but the most common problem is that the region is unavailable + if (success) { GridRegion region = new GridRegion(); @@ -305,6 +315,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { + message = "Error parsing response from grid."; m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); return null; } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 7a0228b..e9d41c7 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -204,15 +204,26 @@ namespace OpenSim.Services.HypergridService return true; } - public GridRegion GetHyperlinkRegion(UUID regionID) + public GridRegion GetHyperlinkRegion(UUID regionID, out string message) { m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get hyperlink region {0}", regionID); + message = null; if (!m_AllowTeleportsToAnyRegion) + { // Don't even check the given regionID + message = "Teleporting to the default region."; return m_DefaultGatewayRegion; + } GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID); + + if (region == null) + { + message = "The teleport destination could not be found."; + return null; + } + return region; } diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index bece4c7..a846bad 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -37,7 +37,7 @@ namespace OpenSim.Services.Interfaces public interface IGatekeeperService { bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason); - GridRegion GetHyperlinkRegion(UUID regionID); + GridRegion GetHyperlinkRegion(UUID regionID, out string message); bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index b61b5e8..6d6e3d6 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -750,9 +750,10 @@ namespace OpenSim.Services.LLLoginService UUID regionID; ulong handle; string imageURL = string.Empty, reason = string.Empty; + string message; if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) { - GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID); + GridRegion destination = m_GatekeeperConnector.GetHyperlinkRegion(gatekeeper, regionID, out message); return destination; } -- cgit v1.1