From 882ba741404a4c233bdf947071a45349b74bd8a3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Sep 2013 22:45:50 +0100
Subject: For debug purposes, allow simulators to force use of earlier
SIMULATION/0.1 teleport protocol even if SIMULATION/0.2 is available.
This is specified in the MaxOutgoingTransferVersion attribute of [EntityTransfer] in OpenSim.ini, see OpenSimDefaults.ini for more details.
Default remains "SIMULATION/0.2"
Primarily for http://opensimulator.org/mantis/view.php?id=6755
---
.../EntityTransfer/EntityTransferModule.cs | 53 ++++++++++++++++++++--
1 file changed, 49 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 9302784..c1c8672 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -56,6 +56,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public const int DefaultMaxTransferDistance = 4095;
public const bool WaitForAgentArrivedAtDestinationDefault = true;
+ public string OutgoingTransferVersionName { get; set; }
+
+ ///
+ /// Determine the maximum entity transfer version we will use for teleports.
+ ///
+ public float MaxOutgoingTransferVersion { get; set; }
+
///
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
///
@@ -151,9 +158,35 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
///
protected virtual void InitialiseCommon(IConfigSource source)
{
+ string transferVersionName = "SIMULATION";
+ float maxTransferVersion = 0.2f;
+
IConfig transferConfig = source.Configs["EntityTransfer"];
if (transferConfig != null)
{
+ string rawVersion
+ = transferConfig.GetString(
+ "MaxOutgoingTransferVersion",
+ string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
+
+ string[] rawVersionComponents = rawVersion.Split(new char[] { '/' });
+
+ bool versionValid = false;
+
+ if (rawVersionComponents.Length >= 2)
+ versionValid = float.TryParse(rawVersionComponents[1], out maxTransferVersion);
+
+ if (!versionValid)
+ {
+ m_log.ErrorFormat(
+ "[ENTITY TRANSFER MODULE]: MaxOutgoingTransferVersion {0} is invalid, using {1}",
+ rawVersion, string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
+ }
+ else
+ {
+ transferVersionName = rawVersionComponents[0];
+ }
+
DisableInterRegionTeleportCancellation
= transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);
@@ -167,6 +200,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
MaxTransferDistance = DefaultMaxTransferDistance;
}
+ OutgoingTransferVersionName = transferVersionName;
+ MaxOutgoingTransferVersion = maxTransferVersion;
+
m_entityTransferStateMachine = new EntityTransferStateMachine(this);
m_Enabled = true;
@@ -623,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (!sp.ValidateAttachments())
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.",
- sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName);
+ sp.Name, sp.Scene.Name, finalDestination.RegionName);
string reason;
string version;
@@ -634,7 +670,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}",
- sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
+ sp.Name, sp.Scene.Name, finalDestination.RegionName, reason);
return;
}
@@ -644,7 +680,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// as server attempts.
m_interRegionTeleportAttempts.Value++;
- m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: {0} max transfer version is {1}/{2}, {3} max version is {4}",
+ sp.Scene.Name, OutgoingTransferVersionName, MaxOutgoingTransferVersion, finalDestination.RegionName, version);
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from
// both regions
@@ -689,7 +727,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
}
- if (version.Equals("SIMULATION/0.2"))
+ // 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 && MaxOutgoingTransferVersion >= versionNumber)
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);
--
cgit v1.1