diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9be6d45..8a4ac1b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -57,14 +57,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
57 | public const int DefaultMaxTransferDistance = 4095; | 57 | public const int DefaultMaxTransferDistance = 4095; |
58 | public const bool WaitForAgentArrivedAtDestinationDefault = true; | 58 | public const bool WaitForAgentArrivedAtDestinationDefault = true; |
59 | 59 | ||
60 | public static readonly string OutgoingTransferVersionName = "SIMULATION"; | ||
61 | |||
62 | /// <summary> | ||
63 | /// Determine the entity transfer version we will use for teleports. | ||
64 | /// </summary> | ||
65 | public static readonly float OutgoingTransferVersion = VersionInfo.SimulationServiceVersion; | ||
66 | |||
67 | private string m_myVersion = ""; | ||
68 | /// <summary> | 60 | /// <summary> |
69 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. | 61 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. |
70 | /// </summary> | 62 | /// </summary> |
@@ -243,8 +235,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
243 | MaxTransferDistance = DefaultMaxTransferDistance; | 235 | MaxTransferDistance = DefaultMaxTransferDistance; |
244 | } | 236 | } |
245 | 237 | ||
246 | m_myVersion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion); | ||
247 | |||
248 | m_entityTransferStateMachine = new EntityTransferStateMachine(this); | 238 | m_entityTransferStateMachine = new EntityTransferStateMachine(this); |
249 | 239 | ||
250 | m_Enabled = true; | 240 | m_Enabled = true; |
@@ -736,10 +726,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
736 | sp.Name, sp.Scene.Name, finalDestination.RegionName); | 726 | sp.Name, sp.Scene.Name, finalDestination.RegionName); |
737 | 727 | ||
738 | string reason; | 728 | string reason; |
739 | string version; | 729 | EntityTransferContext ctx = new EntityTransferContext(); |
740 | 730 | ||
741 | if (!Scene.SimulationService.QueryAccess( | 731 | if (!Scene.SimulationService.QueryAccess( |
742 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position,m_myVersion, sp.Scene.GetFormatsOffered(), out version, out reason)) | 732 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), ctx, out reason)) |
743 | { | 733 | { |
744 | sp.ControllingClient.SendTeleportFailed(reason); | 734 | sp.ControllingClient.SendTeleportFailed(reason); |
745 | 735 | ||
@@ -756,8 +746,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
756 | m_interRegionTeleportAttempts.Value++; | 746 | m_interRegionTeleportAttempts.Value++; |
757 | 747 | ||
758 | m_log.DebugFormat( | 748 | m_log.DebugFormat( |
759 | "[ENTITY TRANSFER MODULE]: {0} transfer version is {1}/{2}, {3} version is {4}", | 749 | "[ENTITY TRANSFER MODULE]: {0} transfer protocol version to {1} is {2} / {3}", |
760 | sp.Scene.Name, OutgoingTransferVersionName, OutgoingTransferVersion, finalDestination.RegionName, version); | 750 | sp.Scene.Name, finalDestination.RegionName, ctx.OutboundVersion, ctx.InboundVersion); |
761 | 751 | ||
762 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 752 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
763 | // both regions | 753 | // both regions |
@@ -837,21 +827,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
837 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 827 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
838 | } | 828 | } |
839 | 829 | ||
840 | // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 or we're forcing | 830 | // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 |
841 | // use of the earlier protocol | 831 | if (ctx.OutboundVersion >= 0.2f) |
842 | float versionNumber = 0.1f; | 832 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , ctx, out reason); |
843 | string[] versionComponents = version.Split(new char[] { '/' }); | ||
844 | if (versionComponents.Length >= 2) | ||
845 | float.TryParse(versionComponents[1], out versionNumber); | ||
846 | |||
847 | if (versionNumber >= 0.2f) | ||
848 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); | ||
849 | else | 833 | else |
850 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); | 834 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, ctx, out reason); |
851 | } | 835 | } |
852 | 836 | ||
853 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 837 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
854 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) | 838 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) |
855 | { | 839 | { |
856 | ulong destinationHandle = finalDestination.RegionHandle; | 840 | ulong destinationHandle = finalDestination.RegionHandle; |
857 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 841 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -1045,13 +1029,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1045 | } | 1029 | } |
1046 | 1030 | ||
1047 | 1031 | ||
1032 | /* | ||
1033 | // TODO: This may be 0.6. Check if still needed | ||
1048 | // For backwards compatibility | 1034 | // For backwards compatibility |
1049 | if (version == "Unknown" || version == string.Empty) | 1035 | if (version == 0f) |
1050 | { | 1036 | { |
1051 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it | 1037 | // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it |
1052 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | 1038 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); |
1053 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | 1039 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); |
1054 | } | 1040 | } |
1041 | */ | ||
1055 | 1042 | ||
1056 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1043 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1057 | 1044 | ||
@@ -1087,7 +1074,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1087 | } | 1074 | } |
1088 | 1075 | ||
1089 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 1076 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
1090 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) | 1077 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) |
1091 | { | 1078 | { |
1092 | ulong destinationHandle = finalDestination.RegionHandle; | 1079 | ulong destinationHandle = finalDestination.RegionHandle; |
1093 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1080 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -1494,9 +1481,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1494 | // now only works for crossings | 1481 | // now only works for crossings |
1495 | 1482 | ||
1496 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, | 1483 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, |
1497 | out string version, out Vector3 newpos, out string failureReason) | 1484 | EntityTransferContext ctx, out Vector3 newpos, out string failureReason) |
1498 | { | 1485 | { |
1499 | version = String.Empty; | ||
1500 | newpos = pos; | 1486 | newpos = pos; |
1501 | failureReason = string.Empty; | 1487 | failureReason = string.Empty; |
1502 | 1488 | ||
@@ -1532,8 +1518,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1532 | string homeURI = scene.GetAgentHomeURI(agentID); | 1518 | string homeURI = scene.GetAgentHomeURI(agentID); |
1533 | 1519 | ||
1534 | if (!scene.SimulationService.QueryAccess( | 1520 | if (!scene.SimulationService.QueryAccess( |
1535 | neighbourRegion, agentID, homeURI, false, newpos, m_myVersion, | 1521 | neighbourRegion, agentID, homeURI, false, newpos, |
1536 | new List<UUID>(), out version, out failureReason)) | 1522 | scene.GetFormatsOffered(), ctx, out failureReason)) |
1537 | { | 1523 | { |
1538 | // remember the fail | 1524 | // remember the fail |
1539 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1525 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); |
@@ -1571,13 +1557,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1571 | uint x; | 1557 | uint x; |
1572 | uint y; | 1558 | uint y; |
1573 | Vector3 newpos; | 1559 | Vector3 newpos; |
1574 | string version; | 1560 | EntityTransferContext ctx = new EntityTransferContext(); |
1575 | string failureReason; | 1561 | string failureReason; |
1576 | 1562 | ||
1577 | Vector3 pos = agent.AbsolutePosition + agent.Velocity; | 1563 | Vector3 pos = agent.AbsolutePosition + agent.Velocity; |
1578 | 1564 | ||
1579 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, | 1565 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, |
1580 | out version, out newpos, out failureReason); | 1566 | ctx, out newpos, out failureReason); |
1581 | if (neighbourRegion == null) | 1567 | if (neighbourRegion == null) |
1582 | { | 1568 | { |
1583 | if (failureReason != String.Empty) | 1569 | if (failureReason != String.Empty) |
@@ -1680,7 +1666,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1680 | /// </summary> | 1666 | /// </summary> |
1681 | public ScenePresence CrossAgentToNewRegionAsync( | 1667 | public ScenePresence CrossAgentToNewRegionAsync( |
1682 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1668 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1683 | bool isFlying, string version) | 1669 | bool isFlying, EntityTransferContext ctx) |
1684 | { | 1670 | { |
1685 | try | 1671 | try |
1686 | { | 1672 | { |
@@ -1699,7 +1685,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1699 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1685 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1700 | } | 1686 | } |
1701 | 1687 | ||
1702 | CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version); | 1688 | CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx); |
1703 | } | 1689 | } |
1704 | catch (Exception e) | 1690 | catch (Exception e) |
1705 | { | 1691 | { |
@@ -1765,7 +1751,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1765 | } | 1751 | } |
1766 | 1752 | ||
1767 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1753 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1768 | bool isFlying, string version) | 1754 | bool isFlying, EntityTransferContext ctx) |
1769 | { | 1755 | { |
1770 | 1756 | ||
1771 | string agentcaps; | 1757 | string agentcaps; |
@@ -1827,6 +1813,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1827 | 1813 | ||
1828 | agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); | 1814 | agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); |
1829 | 1815 | ||
1816 | // TODO: Check since what version this wasn't needed anymore. May be as old as 0.6 | ||
1817 | /* | ||
1818 | // Backwards compatibility. Best effort | ||
1819 | if (version == 0f) | ||
1820 | { | ||
1821 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1822 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1823 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1824 | } | ||
1825 | */ | ||
1830 | 1826 | ||
1831 | // the user may change their profile information in other region, | 1827 | // the user may change their profile information in other region, |
1832 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1828 | // so the userinfo in UserProfileCache is not reliable any more, delete it |