aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs68
1 files changed, 60 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ed14c12..ef5239a 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
56 public const int DefaultMaxTransferDistance = 4095; 56 public const int DefaultMaxTransferDistance = 4095;
57 public const bool WaitForAgentArrivedAtDestinationDefault = true; 57 public const bool WaitForAgentArrivedAtDestinationDefault = true;
58 58
59 public string OutgoingTransferVersionName { get; set; }
60
61 /// <summary>
62 /// Determine the maximum entity transfer version we will use for teleports.
63 /// </summary>
64 public float MaxOutgoingTransferVersion { get; set; }
65
59 /// <summary> 66 /// <summary>
60 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. 67 /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
61 /// </summary> 68 /// </summary>
@@ -151,9 +158,39 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
151 /// <param name="source"></param> 158 /// <param name="source"></param>
152 protected virtual void InitialiseCommon(IConfigSource source) 159 protected virtual void InitialiseCommon(IConfigSource source)
153 { 160 {
161 string transferVersionName = "SIMULATION";
162 float maxTransferVersion = 0.2f;
163
154 IConfig transferConfig = source.Configs["EntityTransfer"]; 164 IConfig transferConfig = source.Configs["EntityTransfer"];
155 if (transferConfig != null) 165 if (transferConfig != null)
156 { 166 {
167 string rawVersion
168 = transferConfig.GetString(
169 "MaxOutgoingTransferVersion",
170 string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
171
172 string[] rawVersionComponents = rawVersion.Split(new char[] { '/' });
173
174 bool versionValid = false;
175
176 if (rawVersionComponents.Length >= 2)
177 versionValid = float.TryParse(rawVersionComponents[1], out maxTransferVersion);
178
179 if (!versionValid)
180 {
181 m_log.ErrorFormat(
182 "[ENTITY TRANSFER MODULE]: MaxOutgoingTransferVersion {0} is invalid, using {1}",
183 rawVersion, string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
184 }
185 else
186 {
187 transferVersionName = rawVersionComponents[0];
188
189 m_log.InfoFormat(
190 "[ENTITY TRANSFER MODULE]: MaxOutgoingTransferVersion set to {0}",
191 string.Format("{0}/{1}", transferVersionName, maxTransferVersion));
192 }
193
157 DisableInterRegionTeleportCancellation 194 DisableInterRegionTeleportCancellation
158 = transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false); 195 = transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);
159 196
@@ -167,6 +204,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
167 MaxTransferDistance = DefaultMaxTransferDistance; 204 MaxTransferDistance = DefaultMaxTransferDistance;
168 } 205 }
169 206
207 OutgoingTransferVersionName = transferVersionName;
208 MaxOutgoingTransferVersion = maxTransferVersion;
209
170 m_entityTransferStateMachine = new EntityTransferStateMachine(this); 210 m_entityTransferStateMachine = new EntityTransferStateMachine(this);
171 211
172 m_Enabled = true; 212 m_Enabled = true;
@@ -522,6 +562,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
522 /// </returns> 562 /// </returns>
523 private bool IsWithinMaxTeleportDistance(RegionInfo sourceRegion, GridRegion destRegion) 563 private bool IsWithinMaxTeleportDistance(RegionInfo sourceRegion, GridRegion destRegion)
524 { 564 {
565 if(MaxTransferDistance == 0)
566 return true;
567
525// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); 568// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
526// 569//
527// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", 570// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
@@ -623,7 +666,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
623 if (!sp.ValidateAttachments()) 666 if (!sp.ValidateAttachments())
624 m_log.DebugFormat( 667 m_log.DebugFormat(
625 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", 668 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.",
626 sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); 669 sp.Name, sp.Scene.Name, finalDestination.RegionName);
627 670
628 string reason; 671 string reason;
629 string version; 672 string version;
@@ -634,7 +677,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
634 677
635 m_log.DebugFormat( 678 m_log.DebugFormat(
636 "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", 679 "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}",
637 sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); 680 sp.Name, sp.Scene.Name, finalDestination.RegionName, reason);
638 681
639 return; 682 return;
640 } 683 }
@@ -644,7 +687,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
644 // as server attempts. 687 // as server attempts.
645 m_interRegionTeleportAttempts.Value++; 688 m_interRegionTeleportAttempts.Value++;
646 689
647 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); 690 m_log.DebugFormat(
691 "[ENTITY TRANSFER MODULE]: {0} max transfer version is {1}/{2}, {3} max version is {4}",
692 sp.Scene.Name, OutgoingTransferVersionName, MaxOutgoingTransferVersion, finalDestination.RegionName, version);
648 693
649 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from 694 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
650 // both regions 695 // both regions
@@ -691,7 +736,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
691 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 736 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
692 } 737 }
693 738
694 if (version.Equals("SIMULATION/0.2")) 739 // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 or we're forcing
740 // use of the earlier protocol
741 float versionNumber = 0.1f;
742 string[] versionComponents = version.Split(new char[] { '/' });
743 if (versionComponents.Length >= 2)
744 float.TryParse(versionComponents[1], out versionNumber);
745
746 if (versionNumber == 0.2f && MaxOutgoingTransferVersion >= versionNumber)
695 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 747 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
696 else 748 else
697 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 749 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
@@ -925,7 +977,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
925 977
926 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 978 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
927 { 979 {
928 if (!sp.Scene.IncomingPreCloseAgent(sp)) 980 if (!sp.Scene.IncomingPreCloseClient(sp))
929 return; 981 return;
930 982
931 // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before 983 // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before
@@ -936,7 +988,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
936 // an agent cannot teleport back to this region if it has teleported away. 988 // an agent cannot teleport back to this region if it has teleported away.
937 Thread.Sleep(2000); 989 Thread.Sleep(2000);
938 990
939 sp.Scene.IncomingCloseAgent(sp.UUID, false); 991 sp.Scene.CloseAgent(sp.UUID, false);
940 } 992 }
941 else 993 else
942 { 994 {
@@ -1090,7 +1142,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1090 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1142 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1091 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 1143 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1092 { 1144 {
1093 if (!sp.Scene.IncomingPreCloseAgent(sp)) 1145 if (!sp.Scene.IncomingPreCloseClient(sp))
1094 return; 1146 return;
1095 1147
1096 // RED ALERT!!!! 1148 // RED ALERT!!!!
@@ -1107,7 +1159,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1107 m_log.DebugFormat( 1159 m_log.DebugFormat(
1108 "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name); 1160 "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name);
1109 1161
1110 sp.Scene.IncomingCloseAgent(sp.UUID, false); 1162 sp.Scene.CloseAgent(sp.UUID, false);
1111 } 1163 }
1112 else 1164 else
1113 { 1165 {