diff options
author | Melanie Thielker | 2015-10-31 18:13:02 +0100 |
---|---|---|
committer | Melanie Thielker | 2015-10-31 18:13:02 +0100 |
commit | ea56f4f27c6e707b54e0e29d2477ef3af2a8c732 (patch) | |
tree | cd6334f1e6b81cd502aed93abe5f1fd0ae895e6b /OpenSim/Region/CoreModules | |
parent | Remove testing cruft that is blocking the new protocols. Unit tests no (diff) | |
download | opensim-SC_OLD-ea56f4f27c6e707b54e0e29d2477ef3af2a8c732.zip opensim-SC_OLD-ea56f4f27c6e707b54e0e29d2477ef3af2a8c732.tar.gz opensim-SC_OLD-ea56f4f27c6e707b54e0e29d2477ef3af2a8c732.tar.bz2 opensim-SC_OLD-ea56f4f27c6e707b54e0e29d2477ef3af2a8c732.tar.xz |
Introduce an EntityTransferContext carrying the version numbers to pass
to all interested functions. Should fix the varregion conditional.
Still a testing version, do NOT use in production!
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 29 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 192f65e..e4bc113 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -719,9 +719,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
719 | sp.Name, sp.Scene.Name, finalDestination.RegionName); | 719 | sp.Name, sp.Scene.Name, finalDestination.RegionName); |
720 | 720 | ||
721 | string reason; | 721 | string reason; |
722 | float version; | 722 | EntityTransferContext ctx = new EntityTransferContext(); |
723 | |||
723 | if (!Scene.SimulationService.QueryAccess( | 724 | if (!Scene.SimulationService.QueryAccess( |
724 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), out version, out reason)) | 725 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), ctx, out reason)) |
725 | { | 726 | { |
726 | sp.ControllingClient.SendTeleportFailed(reason); | 727 | sp.ControllingClient.SendTeleportFailed(reason); |
727 | 728 | ||
@@ -738,8 +739,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
738 | m_interRegionTeleportAttempts.Value++; | 739 | m_interRegionTeleportAttempts.Value++; |
739 | 740 | ||
740 | m_log.DebugFormat( | 741 | m_log.DebugFormat( |
741 | "[ENTITY TRANSFER MODULE]: {0} transfer protocol version to {1} is SIMULATION/{2}", | 742 | "[ENTITY TRANSFER MODULE]: {0} transfer protocol version to {1} is {2} / {3}", |
742 | sp.Scene.Name, finalDestination.RegionName, version); | 743 | sp.Scene.Name, finalDestination.RegionName, ctx.OutboundVersion, ctx.InboundVersion); |
743 | 744 | ||
744 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 745 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
745 | // both regions | 746 | // both regions |
@@ -788,14 +789,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
788 | } | 789 | } |
789 | 790 | ||
790 | // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 | 791 | // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 |
791 | if (version >= 0.2f) | 792 | if (ctx.OutboundVersion >= 0.2f) |
792 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 793 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, ctx, out reason); |
793 | else | 794 | else |
794 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 795 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, ctx, out reason); |
795 | } | 796 | } |
796 | 797 | ||
797 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 798 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
798 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason) | 799 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, EntityTransferContext ctx, out string reason) |
799 | { | 800 | { |
800 | ulong destinationHandle = finalDestination.RegionHandle; | 801 | ulong destinationHandle = finalDestination.RegionHandle; |
801 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 802 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -1008,6 +1009,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1008 | 1009 | ||
1009 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1010 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1010 | 1011 | ||
1012 | /* | ||
1013 | // TODO: This may be 0.6. Check if still needed | ||
1011 | // For backwards compatibility | 1014 | // For backwards compatibility |
1012 | if (version == 0f) | 1015 | if (version == 0f) |
1013 | { | 1016 | { |
@@ -1015,6 +1018,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1015 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); | 1018 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); |
1016 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); | 1019 | CrossAttachmentsIntoNewRegion(finalDestination, sp, true); |
1017 | } | 1020 | } |
1021 | */ | ||
1018 | 1022 | ||
1019 | // May need to logout or other cleanup | 1023 | // May need to logout or other cleanup |
1020 | AgentHasMovedAway(sp, logout); | 1024 | AgentHasMovedAway(sp, logout); |
@@ -1050,7 +1054,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1050 | } | 1054 | } |
1051 | 1055 | ||
1052 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 1056 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
1053 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason) | 1057 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, EntityTransferContext ctx, out string reason) |
1054 | { | 1058 | { |
1055 | ulong destinationHandle = finalDestination.RegionHandle; | 1059 | ulong destinationHandle = finalDestination.RegionHandle; |
1056 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1060 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -1430,9 +1434,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1430 | // point is actually in. | 1434 | // point is actually in. |
1431 | // Returns the coordinates and information of the new region or 'null' of it doesn't exist. | 1435 | // Returns the coordinates and information of the new region or 'null' of it doesn't exist. |
1432 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, | 1436 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, |
1433 | out float version, out Vector3 newpos, out string failureReason) | 1437 | EntityTransferContext ctx, out Vector3 newpos, out string failureReason) |
1434 | { | 1438 | { |
1435 | version = 0f; | ||
1436 | newpos = pos; | 1439 | newpos = pos; |
1437 | failureReason = string.Empty; | 1440 | failureReason = string.Empty; |
1438 | string homeURI = scene.GetAgentHomeURI(agentID); | 1441 | string homeURI = scene.GetAgentHomeURI(agentID); |
@@ -1469,7 +1472,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1469 | 1472 | ||
1470 | // Check to see if we have access to the target region. | 1473 | // Check to see if we have access to the target region. |
1471 | if (neighbourRegion != null | 1474 | if (neighbourRegion != null |
1472 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), out version, out failureReason)) | 1475 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), ctx, out failureReason)) |
1473 | { | 1476 | { |
1474 | // remember banned | 1477 | // remember banned |
1475 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1478 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); |
@@ -1500,11 +1503,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1500 | public bool Cross(ScenePresence agent, bool isFlying) | 1503 | public bool Cross(ScenePresence agent, bool isFlying) |
1501 | { | 1504 | { |
1502 | Vector3 newpos; | 1505 | Vector3 newpos; |
1503 | float version; | 1506 | EntityTransferContext ctx = new EntityTransferContext(); |
1504 | string failureReason; | 1507 | string failureReason; |
1505 | 1508 | ||
1506 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, | 1509 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, |
1507 | out version, out newpos, out failureReason); | 1510 | ctx, out newpos, out failureReason); |
1508 | if (neighbourRegion == null) | 1511 | if (neighbourRegion == null) |
1509 | { | 1512 | { |
1510 | agent.ControllingClient.SendAlertMessage(failureReason); | 1513 | agent.ControllingClient.SendAlertMessage(failureReason); |
@@ -1514,7 +1517,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1514 | agent.IsInTransit = true; | 1517 | agent.IsInTransit = true; |
1515 | 1518 | ||
1516 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; | 1519 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; |
1517 | d.BeginInvoke(agent, newpos, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); | 1520 | d.BeginInvoke(agent, newpos, neighbourRegion, isFlying, ctx, CrossAgentToNewRegionCompleted, d); |
1518 | 1521 | ||
1519 | Scene.EventManager.TriggerCrossAgentToNewRegion(agent, isFlying, neighbourRegion); | 1522 | Scene.EventManager.TriggerCrossAgentToNewRegion(agent, isFlying, neighbourRegion); |
1520 | 1523 | ||
@@ -1612,7 +1615,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1612 | /// </summary> | 1615 | /// </summary> |
1613 | public ScenePresence CrossAgentToNewRegionAsync( | 1616 | public ScenePresence CrossAgentToNewRegionAsync( |
1614 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1617 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1615 | bool isFlying, float version) | 1618 | bool isFlying, EntityTransferContext ctx) |
1616 | { | 1619 | { |
1617 | try | 1620 | try |
1618 | { | 1621 | { |
@@ -1631,7 +1634,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1631 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1634 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1632 | } | 1635 | } |
1633 | 1636 | ||
1634 | CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version); | 1637 | CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx); |
1635 | } | 1638 | } |
1636 | catch (Exception e) | 1639 | catch (Exception e) |
1637 | { | 1640 | { |
@@ -1688,7 +1691,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1688 | } | 1691 | } |
1689 | 1692 | ||
1690 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1693 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1691 | bool isFlying, float version) | 1694 | bool isFlying, EntityTransferContext ctx) |
1692 | { | 1695 | { |
1693 | agent.ControllingClient.RequestClientInfo(); | 1696 | agent.ControllingClient.RequestClientInfo(); |
1694 | 1697 | ||
@@ -1740,6 +1743,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1740 | agent.SendOtherAgentsAvatarDataToClient(); | 1743 | agent.SendOtherAgentsAvatarDataToClient(); |
1741 | agent.SendOtherAgentsAppearanceToClient(); | 1744 | agent.SendOtherAgentsAppearanceToClient(); |
1742 | 1745 | ||
1746 | // TODO: Check since what version this wasn't needed anymore. May be as old as 0.6 | ||
1747 | /* | ||
1743 | // Backwards compatibility. Best effort | 1748 | // Backwards compatibility. Best effort |
1744 | if (version == 0f) | 1749 | if (version == 0f) |
1745 | { | 1750 | { |
@@ -1747,7 +1752,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1747 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | 1752 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback |
1748 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | 1753 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); |
1749 | } | 1754 | } |
1750 | 1755 | */ | |
1751 | // Next, let's close the child agent connections that are too far away. | 1756 | // Next, let's close the child agent connections that are too far away. |
1752 | uint neighbourx; | 1757 | uint neighbourx; |
1753 | uint neighboury; | 1758 | uint neighboury; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 356f778..3b3350b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -244,10 +244,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
244 | return true; | 244 | return true; |
245 | } | 245 | } |
246 | 246 | ||
247 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason) | 247 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason) |
248 | { | 248 | { |
249 | reason = "Communications failure"; | 249 | reason = "Communications failure"; |
250 | version = VersionInfo.SimulationServiceVersionAcceptedMax; // If it's within the process, use max. If it's not, the connector will overwrite this | ||
251 | if (destination == null) | 250 | if (destination == null) |
252 | return false; | 251 | return false; |
253 | 252 | ||
@@ -260,7 +259,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
260 | 259 | ||
261 | // Var regions here, and the requesting simulator is in an older version. | 260 | // Var regions here, and the requesting simulator is in an older version. |
262 | // We will forbide this, because it crashes the viewers | 261 | // We will forbide this, because it crashes the viewers |
263 | if (version < 0.3f && size != 256) | 262 | if (ctx.OutboundVersion < 0.3f && size != 256) |
264 | { | 263 | { |
265 | reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; | 264 | reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; |
266 | m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from older simulator was denied"); | 265 | m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from older simulator was denied"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index e2f52c4..1e095ca 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -205,21 +205,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
205 | return m_remoteConnector.UpdateAgent(destination, cAgentData); | 205 | return m_remoteConnector.UpdateAgent(destination, cAgentData); |
206 | } | 206 | } |
207 | 207 | ||
208 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason) | 208 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason) |
209 | { | 209 | { |
210 | reason = "Communications failure"; | 210 | reason = "Communications failure"; |
211 | version = 0f; | ||
212 | 211 | ||
213 | if (destination == null) | 212 | if (destination == null) |
214 | return false; | 213 | return false; |
215 | 214 | ||
216 | // Try local first | 215 | // Try local first |
217 | if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason)) | 216 | if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason)) |
218 | return true; | 217 | return true; |
219 | 218 | ||
220 | // else do the remote thing | 219 | // else do the remote thing |
221 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) | 220 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
222 | return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason); | 221 | return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); |
223 | 222 | ||
224 | return false; | 223 | return false; |
225 | } | 224 | } |