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 | |
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!
10 files changed, 81 insertions, 59 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 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 9e91d7d..d07b15a 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes; | |||
35 | 35 | ||
36 | namespace OpenSim.Region.Framework.Interfaces | 36 | namespace OpenSim.Region.Framework.Interfaces |
37 | { | 37 | { |
38 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version); | 38 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx); |
39 | 39 | ||
40 | public interface IEntityTransferModule | 40 | public interface IEntityTransferModule |
41 | { | 41 | { |
@@ -92,12 +92,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
92 | 92 | ||
93 | void EnableChildAgent(ScenePresence agent, GridRegion region); | 93 | void EnableChildAgent(ScenePresence agent, GridRegion region); |
94 | 94 | ||
95 | GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out float version, | 95 | GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, EntityTransferContext ctx, |
96 | out Vector3 newpos, out string reason); | 96 | out Vector3 newpos, out string reason); |
97 | 97 | ||
98 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); | 98 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); |
99 | 99 | ||
100 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version); | 100 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx); |
101 | 101 | ||
102 | bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition); | 102 | bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition); |
103 | } | 103 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3b13e64..d08237e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
41 | using OpenSim.Region.PhysicsModules.SharedBase; | 41 | using OpenSim.Region.PhysicsModules.SharedBase; |
42 | using OpenSim.Region.Framework.Scenes.Serialization; | 42 | using OpenSim.Region.Framework.Scenes.Serialization; |
43 | using PermissionMask = OpenSim.Framework.PermissionMask; | 43 | using PermissionMask = OpenSim.Framework.PermissionMask; |
44 | using OpenSim.Services.Interfaces; | ||
44 | 45 | ||
45 | namespace OpenSim.Region.Framework.Scenes | 46 | namespace OpenSim.Region.Framework.Scenes |
46 | { | 47 | { |
@@ -476,7 +477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
476 | ) | 477 | ) |
477 | { | 478 | { |
478 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 479 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
479 | float version = 0f; | 480 | EntityTransferContext ctx = new EntityTransferContext(); |
480 | Vector3 newpos = Vector3.Zero; | 481 | Vector3 newpos = Vector3.Zero; |
481 | string failureReason = String.Empty; | 482 | string failureReason = String.Empty; |
482 | OpenSim.Services.Interfaces.GridRegion destination = null; | 483 | OpenSim.Services.Interfaces.GridRegion destination = null; |
@@ -496,7 +497,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
496 | 497 | ||
497 | // We set the avatar position as being the object | 498 | // We set the avatar position as being the object |
498 | // position to get the region to send to | 499 | // position to get the region to send to |
499 | if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null) | 500 | if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, ctx, out newpos, out failureReason)) == null) |
500 | { | 501 | { |
501 | canCross = false; | 502 | canCross = false; |
502 | break; | 503 | break; |
@@ -557,14 +558,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
557 | // threads rather than any replace threadpool that we might be using. | 558 | // threads rather than any replace threadpool that we might be using. |
558 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | 559 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) |
559 | { | 560 | { |
560 | entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version); | 561 | entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, ctx); |
561 | CrossAgentToNewRegionCompleted(av); | 562 | CrossAgentToNewRegionCompleted(av); |
562 | } | 563 | } |
563 | else | 564 | else |
564 | { | 565 | { |
565 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | 566 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; |
566 | d.BeginInvoke( | 567 | d.BeginInvoke( |
567 | av, val, destination, av.Flying, version, | 568 | av, val, destination, av.Flying, ctx, |
568 | ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null); | 569 | ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null); |
569 | } | 570 | } |
570 | } | 571 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6faeefd..5142514 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -176,6 +176,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
176 | 176 | ||
177 | float version; | 177 | float version; |
178 | 178 | ||
179 | float outboundVersion = 0f; | ||
180 | float inboundVersion = 0f; | ||
179 | 181 | ||
180 | if (minVersionProvided == 0f) // string version or older | 182 | if (minVersionProvided == 0f) // string version or older |
181 | { | 183 | { |
@@ -221,24 +223,22 @@ namespace OpenSim.Server.Handlers.Simulation | |||
221 | } | 223 | } |
222 | 224 | ||
223 | // Determine versions to use | 225 | // Determine versions to use |
224 | float inboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); | 226 | // This is intentionally inverted. Inbound and Outbound refer to the direction of the transfer. |
225 | float outboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); | 227 | // Therefore outbound means from the sender to the receier and inbound means from the receiver to the sender. |
228 | // So outbound is what we will accept and inbound is what we will send. Confused yet? | ||
229 | outboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); | ||
230 | inboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); | ||
226 | 231 | ||
227 | // In this stage, we use only a single version number. Future regions may use asymmetrical protocols. | 232 | // Here, the two versions we determined are combined into a single version for legacy response. |
228 | // Here, the two versions we determined are combined into a single version for now. | ||
229 | version = Math.Max(inboundVersion, outboundVersion); | 233 | version = Math.Max(inboundVersion, outboundVersion); |
230 | 234 | ||
231 | // Since only using a single version, we must do this check. Once the plumbing is in for asymmetrical | ||
232 | // protocols, this will go away, allowing more working combinations. | ||
233 | if (version < VersionInfo.SimulationServiceVersionAcceptedMin || | 235 | if (version < VersionInfo.SimulationServiceVersionAcceptedMin || |
234 | version > VersionInfo.SimulationServiceVersionAcceptedMax || | 236 | version > VersionInfo.SimulationServiceVersionAcceptedMax || |
235 | version < VersionInfo.SimulationServiceVersionSupportedMin || | 237 | version < VersionInfo.SimulationServiceVersionSupportedMin || |
236 | version > VersionInfo.SimulationServiceVersionSupportedMax) | 238 | version > VersionInfo.SimulationServiceVersionSupportedMax) |
237 | { | 239 | { |
238 | resp["success"] = OSD.FromBoolean(false); | 240 | // If the single version can't resolve, fall back to safest. This will only affect very old regions. |
239 | resp["reason"] = OSD.FromString(String.Format("The region protocol version we determined, {0}, is incompatible with the version windows, {1} - {2} and {3} - {4}. No version overlap.", version, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); | 241 | version = 0.1f; |
240 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
241 | return; | ||
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
@@ -256,15 +256,18 @@ namespace OpenSim.Server.Handlers.Simulation | |||
256 | destination.RegionID = regionID; | 256 | destination.RegionID = regionID; |
257 | 257 | ||
258 | string reason; | 258 | string reason; |
259 | float dummyVersion; | 259 | // We're sending the version numbers down to the local connector to do the varregion check. |
260 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out dummyVersion, out reason); | 260 | EntityTransferContext ctx = new EntityTransferContext(); |
261 | ctx.InboundVersion = inboundVersion; | ||
262 | ctx.OutboundVersion = outboundVersion; | ||
263 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); | ||
261 | 264 | ||
262 | resp["success"] = OSD.FromBoolean(result); | 265 | resp["success"] = OSD.FromBoolean(result); |
263 | resp["reason"] = OSD.FromString(reason); | 266 | resp["reason"] = OSD.FromString(reason); |
264 | string legacyVersion = String.Format("SIMULATION/{0}", version); | 267 | string legacyVersion = String.Format("SIMULATION/{0}", version); |
265 | resp["version"] = OSD.FromString(legacyVersion); | 268 | resp["version"] = OSD.FromString(legacyVersion); |
266 | resp["negotiated_inbound_version"] = OSD.FromReal(version); //inboundVersion); | 269 | resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion); |
267 | resp["negotiated_outbound_version"] = OSD.FromReal(version); //outboundVersion); | 270 | resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); |
268 | resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); | 271 | resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); |
269 | 272 | ||
270 | OSDArray featuresWanted = new OSDArray(); | 273 | OSDArray featuresWanted = new OSDArray(); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 9f0cc8e..b93088a 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -282,10 +282,9 @@ namespace OpenSim.Services.Connectors.Simulation | |||
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, out float version, out string reason) | 285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, EntityTransferContext ctx, out string reason) |
286 | { | 286 | { |
287 | reason = "Failed to contact destination"; | 287 | reason = "Failed to contact destination"; |
288 | version = 0f; | ||
289 | 288 | ||
290 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); | 289 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); |
291 | 290 | ||
@@ -333,22 +332,26 @@ namespace OpenSim.Services.Connectors.Simulation | |||
333 | // TODO: lay the pipe for version plumbing | 332 | // TODO: lay the pipe for version plumbing |
334 | if (data.ContainsKey("negotiated_inbound_version") && data["negotiated_inbound_version"] != null) | 333 | if (data.ContainsKey("negotiated_inbound_version") && data["negotiated_inbound_version"] != null) |
335 | { | 334 | { |
336 | version = (float)data["negotiated_version"].AsReal(); | 335 | ctx.InboundVersion = (float)data["negotiated_inbound_version"].AsReal(); |
336 | ctx.OutboundVersion = (float)data["negotiated_outbound_version"].AsReal(); | ||
337 | } | 337 | } |
338 | else if (data["version"] != null && data["version"].AsString() != string.Empty) | 338 | else if (data["version"] != null && data["version"].AsString() != string.Empty) |
339 | { | 339 | { |
340 | string versionString = data["version"].AsString(); | 340 | string versionString = data["version"].AsString(); |
341 | String[] parts = versionString.Split(new char[] {'/'}); | 341 | String[] parts = versionString.Split(new char[] {'/'}); |
342 | if (parts.Length > 1) | 342 | if (parts.Length > 1) |
343 | version = float.Parse(parts[1]); | 343 | { |
344 | ctx.InboundVersion = float.Parse(parts[1]); | ||
345 | ctx.OutboundVersion = float.Parse(parts[1]); | ||
346 | } | ||
344 | } | 347 | } |
345 | 348 | ||
346 | m_log.DebugFormat( | 349 | m_log.DebugFormat( |
347 | "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version SIMULATION/{3}", | 350 | "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}", |
348 | uri, success, reason, version); | 351 | uri, success, reason, ctx.InboundVersion, ctx.OutboundVersion); |
349 | } | 352 | } |
350 | 353 | ||
351 | if (!success || version == 0f) | 354 | if (!success || ctx.InboundVersion == 0f || ctx.OutboundVersion == 0f) |
352 | { | 355 | { |
353 | // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the | 356 | // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the |
354 | // actual failure message | 357 | // actual failure message |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index a2c5327..8e10125 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -452,11 +452,11 @@ namespace OpenSim.Services.HypergridService | |||
452 | 452 | ||
453 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag); | 453 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag); |
454 | 454 | ||
455 | float version; | 455 | EntityTransferContext ctx = new EntityTransferContext(); |
456 | 456 | ||
457 | if (!m_SimulationService.QueryAccess( | 457 | if (!m_SimulationService.QueryAccess( |
458 | destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), | 458 | destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), |
459 | true, aCircuit.startpos, new List<UUID>(), out version, out reason)) | 459 | true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) |
460 | return false; | 460 | return false; |
461 | 461 | ||
462 | return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); | 462 | return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 6f205ad..089507e 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -34,6 +34,18 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
34 | 34 | ||
35 | namespace OpenSim.Services.Interfaces | 35 | namespace OpenSim.Services.Interfaces |
36 | { | 36 | { |
37 | public class EntityTransferContext | ||
38 | { | ||
39 | public EntityTransferContext() | ||
40 | { | ||
41 | InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax; | ||
42 | OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax; | ||
43 | } | ||
44 | |||
45 | public float InboundVersion { get; set; } | ||
46 | public float OutboundVersion { get; set; } | ||
47 | } | ||
48 | |||
37 | public interface ISimulationService | 49 | public interface ISimulationService |
38 | { | 50 | { |
39 | /// <summary> | 51 | /// <summary> |
@@ -92,7 +104,7 @@ namespace OpenSim.Services.Interfaces | |||
92 | /// <param name="version">Version that the target simulator is running</param> | 104 | /// <param name="version">Version that the target simulator is running</param> |
93 | /// <param name="reason">[out] Optional error message</param> | 105 | /// <param name="reason">[out] Optional error message</param> |
94 | /// <returns>True: ok; False: not allowed</returns> | 106 | /// <returns>True: ok; False: not allowed</returns> |
95 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason); | 107 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason); |
96 | 108 | ||
97 | /// <summary> | 109 | /// <summary> |
98 | /// Message from receiving region to departing region, telling it got contacted by the client. | 110 | /// Message from receiving region to departing region, telling it got contacted by the client. |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 4f8f459..0b38738 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -983,10 +983,10 @@ namespace OpenSim.Services.LLLoginService | |||
983 | 983 | ||
984 | private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason) | 984 | private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason) |
985 | { | 985 | { |
986 | float version; | 986 | EntityTransferContext ctx = new EntityTransferContext(); |
987 | 987 | ||
988 | if (!simConnector.QueryAccess( | 988 | if (!simConnector.QueryAccess( |
989 | region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), out version, out reason)) | 989 | region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) |
990 | return false; | 990 | return false; |
991 | 991 | ||
992 | return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); | 992 | return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); |