Introduce an EntityTransferContext carrying the version numbers to pass

to all interested functions. Should fix the varregion conditional.
Still a testing version, do NOT use in production!
This commit is contained in:
Melanie Thielker
2015-10-31 18:13:02 +01:00
parent e8e0ba6d8f
commit ea56f4f27c
10 changed files with 81 additions and 59 deletions

View File

@@ -282,10 +282,9 @@ namespace OpenSim.Services.Connectors.Simulation
}
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, out float version, out string reason)
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, EntityTransferContext ctx, out string reason)
{
reason = "Failed to contact destination";
version = 0f;
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
@@ -333,22 +332,26 @@ namespace OpenSim.Services.Connectors.Simulation
// TODO: lay the pipe for version plumbing
if (data.ContainsKey("negotiated_inbound_version") && data["negotiated_inbound_version"] != null)
{
version = (float)data["negotiated_version"].AsReal();
ctx.InboundVersion = (float)data["negotiated_inbound_version"].AsReal();
ctx.OutboundVersion = (float)data["negotiated_outbound_version"].AsReal();
}
else if (data["version"] != null && data["version"].AsString() != string.Empty)
{
string versionString = data["version"].AsString();
String[] parts = versionString.Split(new char[] {'/'});
if (parts.Length > 1)
version = float.Parse(parts[1]);
{
ctx.InboundVersion = float.Parse(parts[1]);
ctx.OutboundVersion = float.Parse(parts[1]);
}
}
m_log.DebugFormat(
"[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version SIMULATION/{3}",
uri, success, reason, version);
"[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}",
uri, success, reason, ctx.InboundVersion, ctx.OutboundVersion);
}
if (!success || version == 0f)
if (!success || ctx.InboundVersion == 0f || ctx.OutboundVersion == 0f)
{
// If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the
// actual failure message

View File

@@ -452,11 +452,11 @@ namespace OpenSim.Services.HypergridService
m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag);
float version;
EntityTransferContext ctx = new EntityTransferContext();
if (!m_SimulationService.QueryAccess(
destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(),
true, aCircuit.startpos, new List<UUID>(), out version, out reason))
true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
return false;
return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason);

View File

@@ -34,6 +34,18 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Services.Interfaces
{
public class EntityTransferContext
{
public EntityTransferContext()
{
InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax;
OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax;
}
public float InboundVersion { get; set; }
public float OutboundVersion { get; set; }
}
public interface ISimulationService
{
/// <summary>
@@ -92,7 +104,7 @@ namespace OpenSim.Services.Interfaces
/// <param name="version">Version that the target simulator is running</param>
/// <param name="reason">[out] Optional error message</param>
/// <returns>True: ok; False: not allowed</returns>
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason);
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason);
/// <summary>
/// Message from receiving region to departing region, telling it got contacted by the client.

View File

@@ -983,10 +983,10 @@ namespace OpenSim.Services.LLLoginService
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
{
float version;
EntityTransferContext ctx = new EntityTransferContext();
if (!simConnector.QueryAccess(
region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), out version, out reason))
region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
return false;
return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);