When teleporting using Hypergrid, show more informative error messages in case of error

0.8.0.3
Oren Hurvitz 2014-04-03 12:47:20 +03:00
parent 65c4cb48ac
commit 6d2893be67
8 changed files with 74 additions and 16 deletions

View File

@ -239,18 +239,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
GridRegion gatekeeper = new GridRegion(); GridRegion gatekeeper = new GridRegion();
gatekeeper.ServerURI = url; gatekeeper.ServerURI = url;
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(im.RegionID)); string message;
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(im.RegionID), out message);
if (finalDestination != null) if (finalDestination != null)
{ {
ScenePresence sp = scene.GetScenePresence(client.AgentId); ScenePresence sp = scene.GetScenePresence(client.AgentId);
IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
if (transferMod != null && sp != null) if (transferMod != null && sp != null)
{
if (message != null)
sp.ControllingClient.SendAgentAlertMessage(message, true);
transferMod.DoTeleport( transferMod.DoTeleport(
sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f), sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
Vector3.UnitX, teleportflags); Vector3.UnitX, teleportflags);
} }
} }
else
{
m_log.InfoFormat("[HG LURE MODULE]: Lure failed: {0}", message);
client.SendAgentAlertMessage(message, true);
}
}
} }
} }
} }

View File

@ -529,14 +529,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (reg != null) if (reg != null)
{ {
finalDestination = GetFinalDestination(reg); string message;
finalDestination = GetFinalDestination(reg, out message);
if (finalDestination == null) if (finalDestination == null)
{ {
m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}", m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}",
LogHeader, sp.Name, sp.UUID); LogHeader, sp.Name, sp.UUID, message);
sp.ControllingClient.SendTeleportFailed("Problem at destination"); sp.ControllingClient.SendTeleportFailed(message);
return; return;
} }
@ -557,6 +558,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
if (message != null)
sp.ControllingClient.SendAgentAlertMessage(message, true);
// //
// This is it // This is it
// //
@ -1327,8 +1331,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
scene.SendKillObject(new List<uint> { localID }); scene.SendKillObject(new List<uint> { localID });
} }
protected virtual GridRegion GetFinalDestination(GridRegion region) protected virtual GridRegion GetFinalDestination(GridRegion region, out string message)
{ {
message = null;
return region; return region;
} }

View File

@ -225,19 +225,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#region HG overrides of IEntiryTransferModule #region HG overrides of IEntiryTransferModule
protected override GridRegion GetFinalDestination(GridRegion region) protected override GridRegion GetFinalDestination(GridRegion region, out string message)
{ {
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags);
message = null;
if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
{ {
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink"); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink");
GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID, out message);
if (real_destination != null) if (real_destination != null)
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination: ServerURI={0}", real_destination.ServerURI);
else else
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion of region {0} from Gatekeeper {1} failed: {2}", region.RegionID, region.ServerURI, message);
return real_destination; return real_destination;
} }
@ -533,7 +534,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
GridRegion gatekeeper = new GridRegion(); GridRegion gatekeeper = new GridRegion();
gatekeeper.ServerURI = lm.Gatekeeper; gatekeeper.ServerURI = lm.Gatekeeper;
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); string message;
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), out message);
if (finalDestination != null) if (finalDestination != null)
{ {
@ -541,10 +543,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
if (transferMod != null && sp != null) if (transferMod != null && sp != null)
{
if (message != null)
sp.ControllingClient.SendAgentAlertMessage(message, true);
transferMod.DoTeleport( transferMod.DoTeleport(
sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX, sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
} }
}
else
{
remoteClient.SendTeleportFailed(message);
return;
}
} }

View File

@ -94,11 +94,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
UUID regionID = UUID.Zero; UUID regionID = UUID.Zero;
UUID.TryParse(regionID_str, out regionID); UUID.TryParse(regionID_str, out regionID);
GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID); string message;
GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID, out message);
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
if (regInfo == null) if (regInfo == null)
{
hash["result"] = "false"; hash["result"] = "false";
}
else else
{ {
hash["result"] = "true"; hash["result"] = "true";
@ -112,6 +115,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
hash["http_port"] = regInfo.HttpPort.ToString(); hash["http_port"] = regInfo.HttpPort.ToString();
hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
} }
if (message != null)
hash["message"] = message;
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
response.Value = hash; response.Value = hash;
return response; return response;

View File

@ -202,7 +202,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
return mapTile; return mapTile;
} }
public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID, out string message)
{ {
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
hash["region_uuid"] = regionID.ToString(); hash["region_uuid"] = regionID.ToString();
@ -219,12 +219,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
catch (Exception e) catch (Exception e)
{ {
message = "Error contacting grid.";
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
return null; return null;
} }
if (response.IsFault) if (response.IsFault)
{ {
message = "Error contacting grid.";
m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString);
return null; return null;
} }
@ -236,6 +238,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
bool success = false; bool success = false;
Boolean.TryParse((string)hash["result"], out success); 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) if (success)
{ {
GridRegion region = new GridRegion(); GridRegion region = new GridRegion();
@ -305,6 +315,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
catch (Exception e) catch (Exception e)
{ {
message = "Error parsing response from grid.";
m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace);
return null; return null;
} }

View File

@ -204,15 +204,26 @@ namespace OpenSim.Services.HypergridService
return true; 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); m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to get hyperlink region {0}", regionID);
message = null;
if (!m_AllowTeleportsToAnyRegion) if (!m_AllowTeleportsToAnyRegion)
{
// Don't even check the given regionID // Don't even check the given regionID
message = "Teleporting to the default region.";
return m_DefaultGatewayRegion; return m_DefaultGatewayRegion;
}
GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID); GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID);
if (region == null)
{
message = "The teleport destination could not be found.";
return null;
}
return region; return region;
} }

View File

@ -37,7 +37,7 @@ namespace OpenSim.Services.Interfaces
public interface IGatekeeperService public interface IGatekeeperService
{ {
bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, 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); GridRegion GetHyperlinkRegion(UUID regionID, out string message);
bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason); bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason);

View File

@ -750,9 +750,10 @@ namespace OpenSim.Services.LLLoginService
UUID regionID; UUID regionID;
ulong handle; ulong handle;
string imageURL = string.Empty, reason = string.Empty; string imageURL = string.Empty, reason = string.Empty;
string message;
if (m_GatekeeperConnector.LinkRegion(gatekeeper, out regionID, out handle, out domainName, out imageURL, out reason)) 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; return destination;
} }