From dc6d9eadf33b9a0321664d676030b07b2bd04bed Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 31 Oct 2015 00:01:35 +0100
Subject: Testing stage of the new versioning system. Use at own risk. May not
work. Will eat your babies. Yada. Yada.
---
.../EntityTransfer/EntityTransferModule.cs | 47 ++++++++--------------
.../Simulation/LocalSimulationConnector.cs | 15 ++-----
.../Simulation/RemoteSimulationConnector.cs | 8 ++--
.../Framework/Interfaces/IEntityTransferModule.cs | 6 +--
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
5 files changed, 28 insertions(+), 50 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 155a085..ab9f200 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -57,13 +57,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public const int DefaultMaxTransferDistance = 4095;
public const bool WaitForAgentArrivedAtDestinationDefault = true;
- public static readonly string OutgoingTransferVersionName = "SIMULATION";
-
- ///
- /// Determine the entity transfer version we will use for teleports.
- ///
- public static readonly float OutgoingTransferVersion = VersionInfo.SimulationServiceVersion;
-
///
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
///
@@ -726,10 +719,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, sp.Scene.Name, finalDestination.RegionName);
string reason;
- string version;
- string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion);
+ float version;
if (!Scene.SimulationService.QueryAccess(
- finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason))
+ finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), out version, out reason))
{
sp.ControllingClient.SendTeleportFailed(reason);
@@ -746,8 +738,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_interRegionTeleportAttempts.Value++;
m_log.DebugFormat(
- "[ENTITY TRANSFER MODULE]: {0} transfer version is {1}/{2}, {3} version is {4}",
- sp.Scene.Name, OutgoingTransferVersionName, OutgoingTransferVersion, finalDestination.RegionName, version);
+ "[ENTITY TRANSFER MODULE]: {0} transfer version is SIMULATION/{2}, {3} version is {4}",
+ sp.Scene.Name, version, finalDestination.RegionName, version);
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from
// both regions
@@ -795,21 +787,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
}
- // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 or we're forcing
- // use of the earlier protocol
- float versionNumber = 0.1f;
- string[] versionComponents = version.Split(new char[] { '/' });
- if (versionComponents.Length >= 2)
- float.TryParse(versionComponents[1], out versionNumber);
-
- if (versionNumber >= 0.2f)
+ // We're going to fallback to V1 if the destination gives us anything smaller than 0.2
+ if (version >= 0.2f)
TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
else
TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
}
private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
- IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason)
+ IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason)
{
ulong destinationHandle = finalDestination.RegionHandle;
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
@@ -1023,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
// For backwards compatibility
- if (version == "Unknown" || version == string.Empty)
+ if (version == 0f)
{
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
@@ -1064,7 +1050,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
- IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason)
+ IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason)
{
ulong destinationHandle = finalDestination.RegionHandle;
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
@@ -1444,9 +1430,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// point is actually in.
// Returns the coordinates and information of the new region or 'null' of it doesn't exist.
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
- out string version, out Vector3 newpos, out string failureReason)
+ out float version, out Vector3 newpos, out string failureReason)
{
- version = String.Empty;
+ version = 0f;
newpos = pos;
failureReason = string.Empty;
string homeURI = scene.GetAgentHomeURI(agentID);
@@ -1482,9 +1468,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
// Check to see if we have access to the target region.
- string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion);
if (neighbourRegion != null
- && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason))
+ && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), out version, out failureReason))
{
// remember banned
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
@@ -1515,7 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public bool Cross(ScenePresence agent, bool isFlying)
{
Vector3 newpos;
- string version;
+ float version;
string failureReason;
GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition,
@@ -1627,7 +1612,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
///
public ScenePresence CrossAgentToNewRegionAsync(
ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
- bool isFlying, string version)
+ bool isFlying, float version)
{
try
{
@@ -1703,7 +1688,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
- bool isFlying, string version)
+ bool isFlying, float version)
{
agent.ControllingClient.RequestClientInfo();
@@ -1756,7 +1741,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.SendOtherAgentsAppearanceToClient();
// Backwards compatibility. Best effort
- if (version == "Unknown" || version == string.Empty)
+ if (version == 0f)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 3800b3f..32ac992 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -81,8 +81,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
public void InitialiseService(IConfigSource configSource)
{
- ServiceVersion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion);
- m_log.InfoFormat("[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion);
}
public void PostInitialise()
@@ -251,10 +249,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return true;
}
- public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List features, out string version, out string reason)
+ public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, out float version, out string reason)
{
reason = "Communications failure";
- version = ServiceVersion;
+ version = VersionInfo.SimulationServiceVersionAcceptedMax; // If it's within the process, use max. If it's not, the connector will overwrite this
if (destination == null)
return false;
@@ -265,17 +263,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// s.RegionInfo.RegionName, destination.RegionHandle);
uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
- float theirVersionNumber = 0f;
- string[] versionComponents = theirversion.Split(new char[] { '/' });
- if (versionComponents.Length >= 2)
- float.TryParse(versionComponents[1], out theirVersionNumber);
-
// Var regions here, and the requesting simulator is in an older version.
// We will forbide this, because it crashes the viewers
- if (theirVersionNumber < 0.3f && size > 256)
+ if (version < 0.3f && size != 256)
{
reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
- m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber);
+ m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from older simulator was denied");
return false;
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index f963242..e2f52c4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -205,21 +205,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return m_remoteConnector.UpdateAgent(destination, cAgentData);
}
- public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List features, out string version, out string reason)
+ public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, out float version, out string reason)
{
reason = "Communications failure";
- version = "Unknown";
+ version = 0f;
if (destination == null)
return false;
// Try local first
- if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason))
+ if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason))
return true;
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionID))
- return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason);
+ return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason);
return false;
}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 1ebef90..9e91d7d 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
- public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version);
+ public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version);
public interface IEntityTransferModule
{
@@ -92,12 +92,12 @@ namespace OpenSim.Region.Framework.Interfaces
void EnableChildAgent(ScenePresence agent, GridRegion region);
- GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version,
+ GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out float version,
out Vector3 newpos, out string reason);
void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
- ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version);
+ ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version);
bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition);
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1d89267..f5e2c9d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -480,7 +480,7 @@ namespace OpenSim.Region.Framework.Scenes
)
{
IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface();
- string version = String.Empty;
+ float version = 0f;
Vector3 newpos = Vector3.Zero;
string failureReason = String.Empty;
OpenSim.Services.Interfaces.GridRegion destination = null;
--
cgit v1.1