From 979b17165b7e504385187ab082ef0a8cd50605bd 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 ++++++++++++++++++++-- .../Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +- bin/OpenSimDefaults.ini | 10 +++- 3 files changed, 59 insertions(+), 6 deletions(-) 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); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 8c25dbc..3ba34dd 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestSameSimulatorIsolatedRegionsV2() { TestHelpers.InMethod(); -// TestHelpers.EnableLogging(); + TestHelpers.EnableLogging(); UUID userId = TestHelpers.ParseTail(0x1); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 7954a14..8da4daf 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -636,7 +636,6 @@ Cap_AvatarPickerSearch = "localhost" - [Chat] ; Controls whether the chat module is enabled. Default is true. enabled = true; @@ -652,6 +651,15 @@ [EntityTransfer] + ; The maximum protocol version that we will use for outgoing transfers + ; Valid values are + ; "SIMULATION/0.2" + ; - this is the default. A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol + ; - this protocol is more efficient than "SIMULATION/0.1" + ; "SIMULATION/0.1" + ; - this is an older teleport protocol used in OpenSimulator 0.7.5 and before. + MaxOutgoingTransferVersion = "SIMULATION/0.2" + ; The maximum distance in regions that an agent is allowed to teleport ; along the x or y axis. This is set to 16383 because current viewers ; can't handle teleports that are greater than this distance -- cgit v1.1