diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 1a867fd734..07a09e6685 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -873,8 +873,8 @@ namespace OpenSim.Framework.Servers protected string GetVersionText() { - return String.Format("Version: {0} (interface version {1}, SIMULATION/{2})", - m_version, VersionInfo.MajorInterfaceVersion, VersionInfo.SimulationServiceVersion); + return String.Format("Version: {0} (SIMULATION/{1} - SIMULATION/{2})", + m_version, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax); } /// @@ -1045,4 +1045,4 @@ namespace OpenSim.Framework.Servers /// protected virtual void ShutdownSpecific() {} } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs index 54c4508e7c..a145d344d3 100644 --- a/OpenSim/Framework/VersionInfo.cs +++ b/OpenSim/Framework/VersionInfo.cs @@ -61,7 +61,9 @@ namespace OpenSim /// This is the external interface version. It is separate from the OpenSimulator project version. /// /// - public readonly static int MajorInterfaceVersion = 8; + /// Commented because it's not used anymore, see below for new + /// versioning method. + //public readonly static int MajorInterfaceVersion = 8; /// /// This rules versioning regarding teleports, and compatibility between simulators in that regard. @@ -80,6 +82,9 @@ namespace OpenSim /// "SIMULATION/0.1" /// - this is an older teleport protocol used in OpenSimulator 0.7.5 and before. /// - public readonly static float SimulationServiceVersion = 0.3f; + public readonly static float SimulationServiceVersionAcceptedMin = 0.3f; + public readonly static float SimulationServiceVersionAcceptedMax = 0.4f; + public readonly static float SimulationServiceVersionSupportedMin = 0.3f; + public readonly static float SimulationServiceVersionSupportedMax = 0.4f; } } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 155a08566b..ab9f200a43 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 public const int DefaultMaxTransferDistance = 4095; public const bool WaitForAgentArrivedAtDestinationDefault = true; - public static readonly string OutgoingTransferVersionName = "SIMULATION"; - - /// - /// Determine the entity transfer version we will use for teleports. - /// - public static readonly float OutgoingTransferVersion = VersionInfo.SimulationServiceVersion; - /// /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. /// @@ -726,10 +719,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, sp.Scene.Name, finalDestination.RegionName); string reason; - string version; - string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion); + float version; if (!Scene.SimulationService.QueryAccess( - finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) + finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), out version, out reason)) { sp.ControllingClient.SendTeleportFailed(reason); @@ -746,8 +738,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_interRegionTeleportAttempts.Value++; m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: {0} transfer version is {1}/{2}, {3} version is {4}", - sp.Scene.Name, OutgoingTransferVersionName, OutgoingTransferVersion, finalDestination.RegionName, version); + "[ENTITY TRANSFER MODULE]: {0} transfer version is SIMULATION/{2}, {3} version is {4}", + sp.Scene.Name, version, finalDestination.RegionName, version); // Fixing a bug where teleporting while sitting results in the avatar ending up removed from // both regions @@ -795,21 +787,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); } - // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 or we're forcing - // use of the earlier protocol - float versionNumber = 0.1f; - string[] versionComponents = version.Split(new char[] { '/' }); - if (versionComponents.Length >= 2) - float.TryParse(versionComponents[1], out versionNumber); - - if (versionNumber >= 0.2f) + // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 + if (version >= 0.2f) TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); else TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); } private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, - IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) + IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason) { ulong destinationHandle = finalDestination.RegionHandle; AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); @@ -1023,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); // For backwards compatibility - if (version == "Unknown" || version == string.Empty) + if (version == 0f) { // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one..."); @@ -1064,7 +1050,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, - IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) + IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, float version, out string reason) { ulong destinationHandle = finalDestination.RegionHandle; AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); @@ -1444,9 +1430,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // point is actually in. // Returns the coordinates and information of the new region or 'null' of it doesn't exist. public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, - out string version, out Vector3 newpos, out string failureReason) + out float version, out Vector3 newpos, out string failureReason) { - version = String.Empty; + version = 0f; newpos = pos; failureReason = string.Empty; string homeURI = scene.GetAgentHomeURI(agentID); @@ -1482,9 +1468,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // Check to see if we have access to the target region. - string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion); if (neighbourRegion != null - && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason)) + && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), out version, out failureReason)) { // remember banned m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); @@ -1515,7 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public bool Cross(ScenePresence agent, bool isFlying) { Vector3 newpos; - string version; + float version; string failureReason; GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, @@ -1627,7 +1612,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// public ScenePresence CrossAgentToNewRegionAsync( ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, - bool isFlying, string version) + bool isFlying, float version) { try { @@ -1703,7 +1688,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, - bool isFlying, string version) + bool isFlying, float version) { agent.ControllingClient.RequestClientInfo(); @@ -1756,7 +1741,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.SendOtherAgentsAppearanceToClient(); // Backwards compatibility. Best effort - if (version == "Unknown" || version == string.Empty) + if (version == 0f) { m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); 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 3800b3f4f8..32ac992733 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 public void InitialiseService(IConfigSource configSource) { - ServiceVersion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion); - m_log.InfoFormat("[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); } public void PostInitialise() @@ -251,10 +249,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return true; } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List features, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, out float version, out string reason) { reason = "Communications failure"; - version = ServiceVersion; + version = VersionInfo.SimulationServiceVersionAcceptedMax; // If it's within the process, use max. If it's not, the connector will overwrite this if (destination == null) return false; @@ -265,17 +263,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // s.RegionInfo.RegionName, destination.RegionHandle); uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; - float theirVersionNumber = 0f; - string[] versionComponents = theirversion.Split(new char[] { '/' }); - if (versionComponents.Length >= 2) - float.TryParse(versionComponents[1], out theirVersionNumber); - // Var regions here, and the requesting simulator is in an older version. // We will forbide this, because it crashes the viewers - if (theirVersionNumber < 0.3f && size > 256) + if (version < 0.3f && size != 256) { reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; - m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); + m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from older simulator was denied"); return false; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index f96324210f..e2f52c4c27 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 return m_remoteConnector.UpdateAgent(destination, cAgentData); } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List features, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, out float version, out string reason) { reason = "Communications failure"; - version = "Unknown"; + version = 0f; if (destination == null) return false; // Try local first - if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason)) + if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason)) return true; // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionID)) - return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason); + return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out version, out reason); return false; } diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 1ebef90868..9e91d7d7a6 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs @@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Interfaces { - public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); + public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version); public interface IEntityTransferModule { @@ -92,12 +92,12 @@ namespace OpenSim.Region.Framework.Interfaces void EnableChildAgent(ScenePresence agent, GridRegion region); - GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, + GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out float version, out Vector3 newpos, out string reason); void Cross(SceneObjectGroup sog, Vector3 position, bool silent); - ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); + ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, float version); bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1d89267eca..f5e2c9d2fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -480,7 +480,7 @@ namespace OpenSim.Region.Framework.Scenes ) { IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface(); - string version = String.Empty; + float version = 0f; Vector3 newpos = Vector3.Zero; string failureReason = String.Empty; OpenSim.Services.Interfaces.GridRegion destination = null; diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8b4518c5d1..e0fa799520 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -145,9 +145,96 @@ namespace OpenSim.Server.Handlers.Simulation if (args.ContainsKey("agent_home_uri")) agentHomeURI = args["agent_home_uri"].AsString(); - string theirVersion = string.Empty; + // Decode the legacy (string) version and extract the number + float theirVersion = 0f; if (args.ContainsKey("my_version")) - theirVersion = args["my_version"].AsString(); + { + string theirVersionStr = args["my_version"].AsString(); + string[] parts = theirVersionStr.Split(new char[] {'/'}); + if (parts.Length > 1) + theirVersion = float.Parse(parts[1]); + } + + // Decode the new versioning data + float minVersionRequired = 0f; + float maxVersionRequired = 0f; + float minVersionProvided = 0f; + float maxVersionProvided = 0f; + + if (args.ContainsKey("simulation_service_supported_min")) + minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); + if (args.ContainsKey("simulation_service_supported_max")) + maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); + + if (args.ContainsKey("simulation_service_accepted_min")) + minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); + if (args.ContainsKey("simulation_service_accepted_max")) + maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); + + responsedata["int_response_code"] = HttpStatusCode.OK; + OSDMap resp = new OSDMap(3); + + + // If there is no version in the packet at all we're looking at 0.6 or + // even more ancient. Refuse it. + if (minVersionProvided == 0f && theirVersion == 0f) // 0.6 or earlier + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString("Version not supported"); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + + float version; + + if (minVersionProvided == 0f) // Legacy version + { + if (theirVersion >= VersionInfo.SimulationServiceVersionAcceptedMin && + theirVersion <= VersionInfo.SimulationServiceVersionAcceptedMax) + { + version = Math.Max(theirVersion, VersionInfo.SimulationServiceVersionAcceptedMax); + } + else + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("Your version is {0} and we accept only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + } + else + { + // Test for no overlap + if (minVersionProvided > VersionInfo.SimulationServiceVersionAcceptedMax || + maxVersionProvided < VersionInfo.SimulationServiceVersionAcceptedMin) + { + resp["success"] = OSD.FromBoolean(false); + 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)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + if (minVersionRequired > VersionInfo.SimulationServiceVersionSupportedMax || + maxVersionRequired < VersionInfo.SimulationServiceVersionSupportedMin) + { + resp["success"] = OSD.FromBoolean(false); + 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)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + + // Determine version to use + version = Math.Max(Math.Max(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Max(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax)); + if (version < VersionInfo.SimulationServiceVersionAcceptedMin || + version > VersionInfo.SimulationServiceVersionAcceptedMax || + version < VersionInfo.SimulationServiceVersionSupportedMin || + version > VersionInfo.SimulationServiceVersionSupportedMax) + { + resp["success"] = OSD.FromBoolean(false); + 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)); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + } List features = new List(); @@ -163,16 +250,14 @@ namespace OpenSim.Server.Handlers.Simulation destination.RegionID = regionID; string reason; - string version; - bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); - - responsedata["int_response_code"] = HttpStatusCode.OK; - - OSDMap resp = new OSDMap(3); + float dummyVersion; + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out dummyVersion, out reason); resp["success"] = OSD.FromBoolean(result); resp["reason"] = OSD.FromString(reason); - resp["version"] = OSD.FromString(version); + string legacyVersion = String.Format("SIMULATION/{0}", version); + resp["version"] = OSD.FromString(legacyVersion); + resp["negotiated_version"] = OSD.FromReal(version); resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 1eedbefafa..5ee2c9c828 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -282,10 +282,10 @@ namespace OpenSim.Services.Connectors.Simulation } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, List featuresAvailable, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List featuresAvailable, out float version, out string reason) { reason = "Failed to contact destination"; - version = "Unknown"; + version = 0f; // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); @@ -298,7 +298,14 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap request = new OSDMap(); request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); request.Add("position", OSD.FromString(position.ToString())); - request.Add("my_version", OSD.FromString(myversion)); + // To those who still understad this field, we're telling them + // the lowest version just to be safe + request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin))); + // New simulation service negotiation + request.Add("simulation_service_supported_min", OSD.FromReal(VersionInfo.SimulationServiceVersionSupportedMin)); + request.Add("simulation_service_supported_max", OSD.FromReal(VersionInfo.SimulationServiceVersionSupportedMax)); + request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin)); + request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax)); OSDArray features = new OSDArray(); foreach (UUID feature in featuresAvailable) @@ -322,15 +329,24 @@ namespace OpenSim.Services.Connectors.Simulation success = data["success"]; reason = data["reason"].AsString(); - if (data["version"] != null && data["version"].AsString() != string.Empty) - version = data["version"].AsString(); + if (data["negotiated_version"] != null) + { + version = (float)data["negotiated_version"].AsReal(); + } + else if (data["version"] != null && data["version"].AsString() != string.Empty) + { + string versionString = data["version"].AsString(); + String[] parts = versionString.Split(new char[] {'/'}); + if (parts.Length > 1) + version = float.Parse(parts[1]); + } m_log.DebugFormat( - "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3} ({4})", - uri, success, reason, version, data["version"].AsString()); + "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version SIMULATION/{3}", + uri, success, reason, version); } - if (!success) + if (!success || version == 0f) { // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the // actual failure message diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index bee3db3ab0..a2c5327339 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -452,12 +452,11 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag); - string version; + float version; - string myversion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion); if (!m_SimulationService.QueryAccess( destination, aCircuit.AgentID, aCircuit.ServiceURLs["HomeURI"].ToString(), - true, aCircuit.startpos, myversion, new List(), out version, out reason)) + true, aCircuit.startpos, new List(), out version, out reason)) return false; 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 42c414d145..6f205adc3d 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs @@ -92,7 +92,7 @@ namespace OpenSim.Services.Interfaces /// Version that the target simulator is running /// [out] Optional error message /// True: ok; False: not allowed - bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List features, out string version, out string reason); + bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List features, out float version, out string reason); /// /// 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 9e12f9d3b1..4f8f4590bf 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -983,11 +983,10 @@ namespace OpenSim.Services.LLLoginService private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason) { - string myversion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion); - string version; + float version; if (!simConnector.QueryAccess( - region, aCircuit.AgentID, null, true, aCircuit.startpos, myversion, new List(), out version, out reason)) + region, aCircuit.AgentID, null, true, aCircuit.startpos, new List(), out version, out reason)) return false; return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);