aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2015-10-31 00:01:35 +0100
committerMelanie Thielker2015-10-31 00:01:35 +0100
commitdc6d9eadf33b9a0321664d676030b07b2bd04bed (patch)
tree86d8bd48a294b7e0adaf0c6c85c69f4752382c9f /OpenSim
parentfix services handling of visualparameters, avoiding possible crashs (mantis 7... (diff)
downloadopensim-SC-dc6d9eadf33b9a0321664d676030b07b2bd04bed.zip
opensim-SC-dc6d9eadf33b9a0321664d676030b07b2bd04bed.tar.gz
opensim-SC-dc6d9eadf33b9a0321664d676030b07b2bd04bed.tar.bz2
opensim-SC-dc6d9eadf33b9a0321664d676030b07b2bd04bed.tar.xz
Testing stage of the new versioning system. Use at own risk. May not
work. Will eat your babies. Yada. Yada.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs6
-rw-r--r--OpenSim/Framework/VersionInfo.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs47
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs103
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs32
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs5
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs5
12 files changed, 161 insertions, 79 deletions
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index 1a867fd..07a09e6 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -873,8 +873,8 @@ namespace OpenSim.Framework.Servers
873 873
874 protected string GetVersionText() 874 protected string GetVersionText()
875 { 875 {
876 return String.Format("Version: {0} (interface version {1}, SIMULATION/{2})", 876 return String.Format("Version: {0} (SIMULATION/{1} - SIMULATION/{2})",
877 m_version, VersionInfo.MajorInterfaceVersion, VersionInfo.SimulationServiceVersion); 877 m_version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax);
878 } 878 }
879 879
880 /// <summary> 880 /// <summary>
@@ -1045,4 +1045,4 @@ namespace OpenSim.Framework.Servers
1045 /// </summary> 1045 /// </summary>
1046 protected virtual void ShutdownSpecific() {} 1046 protected virtual void ShutdownSpecific() {}
1047 } 1047 }
1048} \ No newline at end of file 1048}
diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs
index 54c4508..a145d34 100644
--- a/OpenSim/Framework/VersionInfo.cs
+++ b/OpenSim/Framework/VersionInfo.cs
@@ -61,7 +61,9 @@ namespace OpenSim
61 /// This is the external interface version. It is separate from the OpenSimulator project version. 61 /// This is the external interface version. It is separate from the OpenSimulator project version.
62 /// 62 ///
63 /// </value> 63 /// </value>
64 public readonly static int MajorInterfaceVersion = 8; 64 /// Commented because it's not used anymore, see below for new
65 /// versioning method.
66 //public readonly static int MajorInterfaceVersion = 8;
65 67
66 /// <summary> 68 /// <summary>
67 /// This rules versioning regarding teleports, and compatibility between simulators in that regard. 69 /// This rules versioning regarding teleports, and compatibility between simulators in that regard.
@@ -80,6 +82,9 @@ namespace OpenSim
80 /// "SIMULATION/0.1" 82 /// "SIMULATION/0.1"
81 /// - this is an older teleport protocol used in OpenSimulator 0.7.5 and before. 83 /// - this is an older teleport protocol used in OpenSimulator 0.7.5 and before.
82 /// </remarks> 84 /// </remarks>
83 public readonly static float SimulationServiceVersion = 0.3f; 85 public readonly static float SimulationServiceVersionAcceptedMin = 0.3f;
86 public readonly static float SimulationServiceVersionAcceptedMax = 0.4f;
87 public readonly static float SimulationServiceVersionSupportedMin = 0.3f;
88 public readonly static float SimulationServiceVersionSupportedMax = 0.4f;
84 } 89 }
85} 90}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 155a085..ab9f200 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -57,13 +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 /// <summary> 60 /// <summary>
68 /// 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.
69 /// </summary> 62 /// </summary>
@@ -726,10 +719,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
726 sp.Name, sp.Scene.Name, finalDestination.RegionName); 719 sp.Name, sp.Scene.Name, finalDestination.RegionName);
727 720
728 string reason; 721 string reason;
729 string version; 722 float version;
730 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion);
731 if (!Scene.SimulationService.QueryAccess( 723 if (!Scene.SimulationService.QueryAccess(
732 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) 724 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), out version, out reason))
733 { 725 {
734 sp.ControllingClient.SendTeleportFailed(reason); 726 sp.ControllingClient.SendTeleportFailed(reason);
735 727
@@ -746,8 +738,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
746 m_interRegionTeleportAttempts.Value++; 738 m_interRegionTeleportAttempts.Value++;
747 739
748 m_log.DebugFormat( 740 m_log.DebugFormat(
749 "[ENTITY TRANSFER MODULE]: {0} transfer version is {1}/{2}, {3} version is {4}", 741 "[ENTITY TRANSFER MODULE]: {0} transfer version is SIMULATION/{2}, {3} version is {4}",
750 sp.Scene.Name, OutgoingTransferVersionName, OutgoingTransferVersion, finalDestination.RegionName, version); 742 sp.Scene.Name, version, finalDestination.RegionName, version);
751 743
752 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from 744 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
753 // both regions 745 // both regions
@@ -795,21 +787,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
795 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 787 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
796 } 788 }
797 789
798 // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 or we're forcing 790 // We're going to fallback to V1 if the destination gives us anything smaller than 0.2
799 // use of the earlier protocol 791 if (version >= 0.2f)
800 float versionNumber = 0.1f;
801 string[] versionComponents = version.Split(new char[] { '/' });
802 if (versionComponents.Length >= 2)
803 float.TryParse(versionComponents[1], out versionNumber);
804
805 if (versionNumber >= 0.2f)
806 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 792 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
807 else 793 else
808 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); 794 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
809 } 795 }
810 796
811 private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, 797 private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
812 IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) 798 IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason)
813 { 799 {
814 ulong destinationHandle = finalDestination.RegionHandle; 800 ulong destinationHandle = finalDestination.RegionHandle;
815 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 801 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
@@ -1023,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1023 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 1009 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
1024 1010
1025 // For backwards compatibility 1011 // For backwards compatibility
1026 if (version == "Unknown" || version == string.Empty) 1012 if (version == 0f)
1027 { 1013 {
1028 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 1014 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
1029 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); 1015 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
@@ -1064,7 +1050,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1064 } 1050 }
1065 1051
1066 private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, 1052 private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination,
1067 IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) 1053 IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason)
1068 { 1054 {
1069 ulong destinationHandle = finalDestination.RegionHandle; 1055 ulong destinationHandle = finalDestination.RegionHandle;
1070 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 1056 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
@@ -1444,9 +1430,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1444 // point is actually in. 1430 // point is actually in.
1445 // Returns the coordinates and information of the new region or 'null' of it doesn't exist. 1431 // Returns the coordinates and information of the new region or 'null' of it doesn't exist.
1446 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, 1432 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
1447 out string version, out Vector3 newpos, out string failureReason) 1433 out float version, out Vector3 newpos, out string failureReason)
1448 { 1434 {
1449 version = String.Empty; 1435 version = 0f;
1450 newpos = pos; 1436 newpos = pos;
1451 failureReason = string.Empty; 1437 failureReason = string.Empty;
1452 string homeURI = scene.GetAgentHomeURI(agentID); 1438 string homeURI = scene.GetAgentHomeURI(agentID);
@@ -1482,9 +1468,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1482 } 1468 }
1483 1469
1484 // Check to see if we have access to the target region. 1470 // Check to see if we have access to the target region.
1485 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion);
1486 if (neighbourRegion != null 1471 if (neighbourRegion != null
1487 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason)) 1472 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), out version, out failureReason))
1488 { 1473 {
1489 // remember banned 1474 // remember banned
1490 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); 1475 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
@@ -1515,7 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1515 public bool Cross(ScenePresence agent, bool isFlying) 1500 public bool Cross(ScenePresence agent, bool isFlying)
1516 { 1501 {
1517 Vector3 newpos; 1502 Vector3 newpos;
1518 string version; 1503 float version;
1519 string failureReason; 1504 string failureReason;
1520 1505
1521 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, 1506 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition,
@@ -1627,7 +1612,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1627 /// </summary> 1612 /// </summary>
1628 public ScenePresence CrossAgentToNewRegionAsync( 1613 public ScenePresence CrossAgentToNewRegionAsync(
1629 ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, 1614 ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1630 bool isFlying, string version) 1615 bool isFlying, float version)
1631 { 1616 {
1632 try 1617 try
1633 { 1618 {
@@ -1703,7 +1688,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1703 } 1688 }
1704 1689
1705 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, 1690 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1706 bool isFlying, string version) 1691 bool isFlying, float version)
1707 { 1692 {
1708 agent.ControllingClient.RequestClientInfo(); 1693 agent.ControllingClient.RequestClientInfo();
1709 1694
@@ -1756,7 +1741,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1756 agent.SendOtherAgentsAppearanceToClient(); 1741 agent.SendOtherAgentsAppearanceToClient();
1757 1742
1758 // Backwards compatibility. Best effort 1743 // Backwards compatibility. Best effort
1759 if (version == "Unknown" || version == string.Empty) 1744 if (version == 0f)
1760 { 1745 {
1761 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); 1746 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1762 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback 1747 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 3800b3f..32ac992 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -81,8 +81,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
81 81
82 public void InitialiseService(IConfigSource configSource) 82 public void InitialiseService(IConfigSource configSource)
83 { 83 {
84 ServiceVersion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion);
85 m_log.InfoFormat("[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion);
86 } 84 }
87 85
88 public void PostInitialise() 86 public void PostInitialise()
@@ -251,10 +249,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
251 return true; 249 return true;
252 } 250 }
253 251
254 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List<UUID> features, out string version, out string reason) 252 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason)
255 { 253 {
256 reason = "Communications failure"; 254 reason = "Communications failure";
257 version = ServiceVersion; 255 version = VersionInfo.SimulationServiceVersionAcceptedMax; // If it's within the process, use max. If it's not, the connector will overwrite this
258 if (destination == null) 256 if (destination == null)
259 return false; 257 return false;
260 258
@@ -265,17 +263,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
265// s.RegionInfo.RegionName, destination.RegionHandle); 263// s.RegionInfo.RegionName, destination.RegionHandle);
266 uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; 264 uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
267 265
268 float theirVersionNumber = 0f;
269 string[] versionComponents = theirversion.Split(new char[] { '/' });
270 if (versionComponents.Length >= 2)
271 float.TryParse(versionComponents[1], out theirVersionNumber);
272
273 // Var regions here, and the requesting simulator is in an older version. 266 // Var regions here, and the requesting simulator is in an older version.
274 // We will forbide this, because it crashes the viewers 267 // We will forbide this, because it crashes the viewers
275 if (theirVersionNumber < 0.3f && size > 256) 268 if (version < 0.3f && size != 256)
276 { 269 {
277 reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; 270 reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
278 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); 271 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from older simulator was denied");
279 return false; 272 return false;
280 273
281 } 274 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index f963242..e2f52c4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -205,21 +205,21 @@ 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, string sversion, List<UUID> features, out string version, out string reason) 208 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason)
209 { 209 {
210 reason = "Communications failure"; 210 reason = "Communications failure";
211 version = "Unknown"; 211 version = 0f;
212 212
213 if (destination == null) 213 if (destination == null)
214 return false; 214 return false;
215 215
216 // Try local first 216 // Try local first
217 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason)) 217 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason))
218 return true; 218 return true;
219 219
220 // else do the remote thing 220 // else do the remote thing
221 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 221 if (!m_localBackend.IsLocalRegion(destination.RegionID))
222 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason); 222 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason);
223 223
224 return false; 224 return false;
225 } 225 }
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 1ebef90..9e91d7d 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
36namespace OpenSim.Region.Framework.Interfaces 36namespace OpenSim.Region.Framework.Interfaces
37{ 37{
38 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); 38 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version);
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 string version, 95 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out float version,
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, string version); 100 ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version);
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 1d89267..f5e2c9d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -480,7 +480,7 @@ namespace OpenSim.Region.Framework.Scenes
480 ) 480 )
481 { 481 {
482 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 482 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
483 string version = String.Empty; 483 float version = 0f;
484 Vector3 newpos = Vector3.Zero; 484 Vector3 newpos = Vector3.Zero;
485 string failureReason = String.Empty; 485 string failureReason = String.Empty;
486 OpenSim.Services.Interfaces.GridRegion destination = null; 486 OpenSim.Services.Interfaces.GridRegion destination = null;
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 8b4518c..e0fa799 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -145,9 +145,96 @@ namespace OpenSim.Server.Handlers.Simulation
145 if (args.ContainsKey("agent_home_uri")) 145 if (args.ContainsKey("agent_home_uri"))
146 agentHomeURI = args["agent_home_uri"].AsString(); 146 agentHomeURI = args["agent_home_uri"].AsString();
147 147
148 string theirVersion = string.Empty; 148 // Decode the legacy (string) version and extract the number
149 float theirVersion = 0f;
149 if (args.ContainsKey("my_version")) 150 if (args.ContainsKey("my_version"))
150 theirVersion = args["my_version"].AsString(); 151 {
152 string theirVersionStr = args["my_version"].AsString();
153 string[] parts = theirVersionStr.Split(new char[] {'/'});
154 if (parts.Length > 1)
155 theirVersion = float.Parse(parts[1]);
156 }
157
158 // Decode the new versioning data
159 float minVersionRequired = 0f;
160 float maxVersionRequired = 0f;
161 float minVersionProvided = 0f;
162 float maxVersionProvided = 0f;
163
164 if (args.ContainsKey("simulation_service_supported_min"))
165 minVersionProvided = (float)args["simulation_service_supported_min"].AsReal();
166 if (args.ContainsKey("simulation_service_supported_max"))
167 maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal();
168
169 if (args.ContainsKey("simulation_service_accepted_min"))
170 minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal();
171 if (args.ContainsKey("simulation_service_accepted_max"))
172 maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal();
173
174 responsedata["int_response_code"] = HttpStatusCode.OK;
175 OSDMap resp = new OSDMap(3);
176
177
178 // If there is no version in the packet at all we're looking at 0.6 or
179 // even more ancient. Refuse it.
180 if (minVersionProvided == 0f && theirVersion == 0f) // 0.6 or earlier
181 {
182 resp["success"] = OSD.FromBoolean(false);
183 resp["reason"] = OSD.FromString("Version not supported");
184 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
185 return;
186 }
187
188 float version;
189
190 if (minVersionProvided == 0f) // Legacy version
191 {
192 if (theirVersion >= VersionInfo.SimulationServiceVersionAcceptedMin &&
193 theirVersion <= VersionInfo.SimulationServiceVersionAcceptedMax)
194 {
195 version = Math.Max(theirVersion, VersionInfo.SimulationServiceVersionAcceptedMax);
196 }
197 else
198 {
199 resp["success"] = OSD.FromBoolean(false);
200 resp["reason"] = OSD.FromString(String.Format("Your version is {0} and we accept only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax));
201 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
202 return;
203 }
204 }
205 else
206 {
207 // Test for no overlap
208 if (minVersionProvided > VersionInfo.SimulationServiceVersionAcceptedMax ||
209 maxVersionProvided < VersionInfo.SimulationServiceVersionAcceptedMin)
210 {
211 resp["success"] = OSD.FromBoolean(false);
212 resp["reason"] = OSD.FromString(String.Format("You provide versions {0} - {1} and we accept only {2} - {3}. No version overlap.", minVersionProvided, maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax));
213 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
214 return;
215 }
216 if (minVersionRequired > VersionInfo.SimulationServiceVersionSupportedMax ||
217 maxVersionRequired < VersionInfo.SimulationServiceVersionSupportedMin)
218 {
219 resp["success"] = OSD.FromBoolean(false);
220 resp["reason"] = OSD.FromString(String.Format("You require versions {0} - {1} and we provide only {2} - {3}. No version overlap.", minVersionRequired, maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax));
221 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
222 return;
223 }
224
225 // Determine version to use
226 version = Math.Max(Math.Max(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Max(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax));
227 if (version < VersionInfo.SimulationServiceVersionAcceptedMin ||
228 version > VersionInfo.SimulationServiceVersionAcceptedMax ||
229 version < VersionInfo.SimulationServiceVersionSupportedMin ||
230 version > VersionInfo.SimulationServiceVersionSupportedMax)
231 {
232 resp["success"] = OSD.FromBoolean(false);
233 resp["reason"] = OSD.FromString(String.Format("The 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));
234 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
235 return;
236 }
237 }
151 238
152 List<UUID> features = new List<UUID>(); 239 List<UUID> features = new List<UUID>();
153 240
@@ -163,16 +250,14 @@ namespace OpenSim.Server.Handlers.Simulation
163 destination.RegionID = regionID; 250 destination.RegionID = regionID;
164 251
165 string reason; 252 string reason;
166 string version; 253 float dummyVersion;
167 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); 254 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out dummyVersion, out reason);
168
169 responsedata["int_response_code"] = HttpStatusCode.OK;
170
171 OSDMap resp = new OSDMap(3);
172 255
173 resp["success"] = OSD.FromBoolean(result); 256 resp["success"] = OSD.FromBoolean(result);
174 resp["reason"] = OSD.FromString(reason); 257 resp["reason"] = OSD.FromString(reason);
175 resp["version"] = OSD.FromString(version); 258 string legacyVersion = String.Format("SIMULATION/{0}", version);
259 resp["version"] = OSD.FromString(legacyVersion);
260 resp["negotiated_version"] = OSD.FromReal(version);
176 resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); 261 resp["variable_wearables_count_supported"] = OSD.FromBoolean(true);
177 262
178 OSDArray featuresWanted = new OSDArray(); 263 OSDArray featuresWanted = new OSDArray();
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 1eedbef..5ee2c9c 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -282,10 +282,10 @@ 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, string myversion, List<UUID> featuresAvailable, out string version, out string reason) 285 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, out float version, out string reason)
286 { 286 {
287 reason = "Failed to contact destination"; 287 reason = "Failed to contact destination";
288 version = "Unknown"; 288 version = 0f;
289 289
290 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); 290 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
291 291
@@ -298,7 +298,14 @@ namespace OpenSim.Services.Connectors.Simulation
298 OSDMap request = new OSDMap(); 298 OSDMap request = new OSDMap();
299 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); 299 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport));
300 request.Add("position", OSD.FromString(position.ToString())); 300 request.Add("position", OSD.FromString(position.ToString()));
301 request.Add("my_version", OSD.FromString(myversion)); 301 // To those who still understad this field, we're telling them
302 // the lowest version just to be safe
303 request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin)));
304 // New simulation service negotiation
305 request.Add("simulation_service_supported_min", OSD.FromReal(VersionInfo.SimulationServiceVersionSupportedMin));
306 request.Add("simulation_service_supported_max", OSD.FromReal(VersionInfo.SimulationServiceVersionSupportedMax));
307 request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin));
308 request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax));
302 309
303 OSDArray features = new OSDArray(); 310 OSDArray features = new OSDArray();
304 foreach (UUID feature in featuresAvailable) 311 foreach (UUID feature in featuresAvailable)
@@ -322,15 +329,24 @@ namespace OpenSim.Services.Connectors.Simulation
322 success = data["success"]; 329 success = data["success"];
323 330
324 reason = data["reason"].AsString(); 331 reason = data["reason"].AsString();
325 if (data["version"] != null && data["version"].AsString() != string.Empty) 332 if (data["negotiated_version"] != null)
326 version = data["version"].AsString(); 333 {
334 version = (float)data["negotiated_version"].AsReal();
335 }
336 else if (data["version"] != null && data["version"].AsString() != string.Empty)
337 {
338 string versionString = data["version"].AsString();
339 String[] parts = versionString.Split(new char[] {'/'});
340 if (parts.Length > 1)
341 version = float.Parse(parts[1]);
342 }
327 343
328 m_log.DebugFormat( 344 m_log.DebugFormat(
329 "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3} ({4})", 345 "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version SIMULATION/{3}",
330 uri, success, reason, version, data["version"].AsString()); 346 uri, success, reason, version);
331 } 347 }
332 348
333 if (!success) 349 if (!success || version == 0f)
334 { 350 {
335 // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the 351 // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the
336 // actual failure message 352 // actual failure message
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index bee3db3..a2c5327 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -452,12 +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 string version; 455 float version;
456 456
457 string myversion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion);
458 if (!m_SimulationService.QueryAccess( 457 if (!m_SimulationService.QueryAccess(
459 destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), 458 destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(),
460 true, aCircuit.startpos, myversion, new List<UUID>(), out version, out reason)) 459 true, aCircuit.startpos, new List<UUID>(), out version, out reason))
461 return false; 460 return false;
462 461
463 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 42c414d..6f205ad 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Services.Interfaces
92 /// <param name="version">Version that the target simulator is running</param> 92 /// <param name="version">Version that the target simulator is running</param>
93 /// <param name="reason">[out] Optional error message</param> 93 /// <param name="reason">[out] Optional error message</param>
94 /// <returns>True: ok; False: not allowed</returns> 94 /// <returns>True: ok; False: not allowed</returns>
95 bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List<UUID> features, out string version, out string reason); 95 bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out float version, out string reason);
96 96
97 /// <summary> 97 /// <summary>
98 /// Message from receiving region to departing region, telling it got contacted by the client. 98 /// 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 9e12f9d..4f8f459 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -983,11 +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 string myversion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion); 986 float version;
987 string version;
988 987
989 if (!simConnector.QueryAccess( 988 if (!simConnector.QueryAccess(
990 region, aCircuit.AgentID, null, true, aCircuit.startpos, myversion, new List<UUID>(), out version, out reason)) 989 region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), out version, out reason))
991 return false; 990 return false;
992 991
993 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); 992 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);