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
varregion
Justin Clark-Casey (justincc) 2013-09-19 22:45:50 +01:00
parent b6f10780c2
commit 979b17165b
3 changed files with 59 additions and 6 deletions

View File

@ -56,6 +56,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public const int DefaultMaxTransferDistance = 4095; public const int DefaultMaxTransferDistance = 4095;
public const bool WaitForAgentArrivedAtDestinationDefault = true; public const bool WaitForAgentArrivedAtDestinationDefault = true;
public string OutgoingTransferVersionName { get; set; }
/// <summary>
/// Determine the maximum entity transfer version we will use for teleports.
/// </summary>
public float MaxOutgoingTransferVersion { get; set; }
/// <summary> /// <summary>
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
/// </summary> /// </summary>
@ -151,9 +158,35 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="source"></param> /// <param name="source"></param>
protected virtual void InitialiseCommon(IConfigSource source) protected virtual void InitialiseCommon(IConfigSource source)
{ {
string transferVersionName = "SIMULATION";
float maxTransferVersion = 0.2f;
IConfig transferConfig = source.Configs["EntityTransfer"]; IConfig transferConfig = source.Configs["EntityTransfer"];
if (transferConfig != null) 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 DisableInterRegionTeleportCancellation
= transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false); = transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);
@ -167,6 +200,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
MaxTransferDistance = DefaultMaxTransferDistance; MaxTransferDistance = DefaultMaxTransferDistance;
} }
OutgoingTransferVersionName = transferVersionName;
MaxOutgoingTransferVersion = maxTransferVersion;
m_entityTransferStateMachine = new EntityTransferStateMachine(this); m_entityTransferStateMachine = new EntityTransferStateMachine(this);
m_Enabled = true; m_Enabled = true;
@ -623,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (!sp.ValidateAttachments()) if (!sp.ValidateAttachments())
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", "[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 reason;
string version; string version;
@ -634,7 +670,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", "[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; return;
} }
@ -644,7 +680,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// as server attempts. // as server attempts.
m_interRegionTeleportAttempts.Value++; 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 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
// both regions // both regions
@ -689,7 +727,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 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); TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
else else
TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);

View File

@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestSameSimulatorIsolatedRegionsV2() public void TestSameSimulatorIsolatedRegionsV2()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1); UUID userId = TestHelpers.ParseTail(0x1);

View File

@ -636,7 +636,6 @@
Cap_AvatarPickerSearch = "localhost" Cap_AvatarPickerSearch = "localhost"
[Chat] [Chat]
; Controls whether the chat module is enabled. Default is true. ; Controls whether the chat module is enabled. Default is true.
enabled = true; enabled = true;
@ -652,6 +651,15 @@
[EntityTransfer] [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 ; 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 ; along the x or y axis. This is set to 16383 because current viewers
; can't handle teleports that are greater than this distance ; can't handle teleports that are greater than this distance