diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 6e089cacd5..b330384068 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -873,8 +873,8 @@ namespace OpenSim.Framework.Servers public 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); } /// 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/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 7d9609fbf4..34b38b9a40 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -802,6 +802,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); } +/* [Test] public void TestSameSimulatorNeighbouringRegionsTeleportV1() { @@ -841,7 +842,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour - lscm.ServiceVersion = "SIMULATION/0.1"; + lscm.ServiceVersion = 0.1f; UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); @@ -909,6 +910,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Check events Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); } +*/ [Test] public void TestSameSimulatorNeighbouringRegionsTeleportV2() diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 0b5d95b9ba..0472f3196f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -63,18 +63,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat { m_config = config.Configs["Chat"]; - if (null == m_config) + if (m_config != null) { - m_log.Info("[CHAT]: no config found, plugin disabled"); - m_enabled = false; - return; - } - - if (!m_config.GetBoolean("enabled", true)) - { - m_log.Info("[CHAT]: plugin disabled by configuration"); - m_enabled = false; - return; + if (!m_config.GetBoolean("enabled", true)) + { + m_log.Info("[CHAT]: plugin disabled by configuration"); + m_enabled = false; + return; + } } m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9be6d45061..8a4ac1b9a9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -57,14 +57,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 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; - - private string m_myVersion = ""; /// /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. /// @@ -243,8 +235,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer MaxTransferDistance = DefaultMaxTransferDistance; } - m_myVersion = string.Format("{0}/{1}", OutgoingTransferVersionName, OutgoingTransferVersion); - m_entityTransferStateMachine = new EntityTransferStateMachine(this); m_Enabled = true; @@ -736,10 +726,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, sp.Scene.Name, finalDestination.RegionName); string reason; - string version; + EntityTransferContext ctx = new EntityTransferContext(); if (!Scene.SimulationService.QueryAccess( - finalDestination, sp.ControllingClient.AgentId, homeURI, true, position,m_myVersion, sp.Scene.GetFormatsOffered(), out version, out reason)) + finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, sp.Scene.GetFormatsOffered(), ctx, out reason)) { sp.ControllingClient.SendTeleportFailed(reason); @@ -756,8 +746,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 protocol version to {1} is {2} / {3}", + sp.Scene.Name, finalDestination.RegionName, ctx.OutboundVersion, ctx.InboundVersion); // Fixing a bug where teleporting while sitting results in the avatar ending up removed from // both regions @@ -837,21 +827,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) - TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); + // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 + if (ctx.OutboundVersion >= 0.2f) + TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , ctx, out reason); else - TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); + TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, ctx, out reason); } private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, - IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) + IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) { ulong destinationHandle = finalDestination.RegionHandle; AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); @@ -1045,13 +1029,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } +/* + // TODO: This may be 0.6. Check if still needed // 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..."); CrossAttachmentsIntoNewRegion(finalDestination, sp, true); } +*/ m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); @@ -1087,7 +1074,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, - IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) + IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) { ulong destinationHandle = finalDestination.RegionHandle; AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); @@ -1494,9 +1481,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // now only works for crossings public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, - out string version, out Vector3 newpos, out string failureReason) + EntityTransferContext ctx, out Vector3 newpos, out string failureReason) { - version = String.Empty; newpos = pos; failureReason = string.Empty; @@ -1532,8 +1518,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string homeURI = scene.GetAgentHomeURI(agentID); if (!scene.SimulationService.QueryAccess( - neighbourRegion, agentID, homeURI, false, newpos, m_myVersion, - new List(), out version, out failureReason)) + neighbourRegion, agentID, homeURI, false, newpos, + scene.GetFormatsOffered(), ctx, out failureReason)) { // remember the fail m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); @@ -1571,13 +1557,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer uint x; uint y; Vector3 newpos; - string version; + EntityTransferContext ctx = new EntityTransferContext(); string failureReason; Vector3 pos = agent.AbsolutePosition + agent.Velocity; GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, - out version, out newpos, out failureReason); + ctx, out newpos, out failureReason); if (neighbourRegion == null) { if (failureReason != String.Empty) @@ -1680,7 +1666,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// public ScenePresence CrossAgentToNewRegionAsync( ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, - bool isFlying, string version) + bool isFlying, EntityTransferContext ctx) { try { @@ -1699,7 +1685,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.ResetFromTransit(agent.UUID); } - CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version); + CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx); } catch (Exception e) { @@ -1765,7 +1751,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, - bool isFlying, string version) + bool isFlying, EntityTransferContext ctx) { string agentcaps; @@ -1827,6 +1813,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); + // TODO: Check since what version this wasn't needed anymore. May be as old as 0.6 +/* + // Backwards compatibility. Best effort + 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 + CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); + } +*/ // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index de0ae4cf9b..6cb15f60f4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -45,11 +45,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// - /// Version of this service. - /// - public string ServiceVersion { get; set; } - /// /// Map region ID to scene. /// @@ -81,8 +76,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,11 +244,9 @@ 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, EntityTransferContext ctx, out string reason) { reason = "Communications failure"; - version = ServiceVersion; if (destination == null) return false; @@ -264,19 +255,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // m_log.DebugFormat( // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", // 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); + uint sizeX = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; + uint sizeY = m_scenes[destination.RegionID].RegionInfo.RegionSizeY; // 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 (ctx.OutboundVersion < 0.3f && (sizeX != 256 || sizeY != 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 c1daae9985..cf19eddf63 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -205,22 +205,20 @@ 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, EntityTransferContext ctx, out string reason) { reason = "Communications failure"; - version = "Unknown"; 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, ctx, 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, ctx, out reason); return false; } diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index 8d192baabf..b9bcb8b7c0 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands m_console.Commands.AddCommand( "Regions", false, "region set", - "region get", + "region set", "Set control information for the currently selected region.", "Currently, the following parameters can be set:\n" + "agent-limit - Current root agent limit. This is persisted over restart.\n" diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 61d199fd81..d172780545 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, EntityTransferContext ctx); public delegate ScenePresence CrossAsyncDelegate(ScenePresence agent, bool isFlying); public interface IEntityTransferModule @@ -93,13 +93,14 @@ namespace OpenSim.Region.Framework.Interfaces void EnableChildAgent(ScenePresence agent, GridRegion region); - GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); - GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); - bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason); -// void Cross(SceneObjectGroup sog, Vector3 position, bool silent); + GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, EntityTransferContext ctx, + out Vector3 newpos, out string reason); + GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); + bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, EntityTransferContext ctx, out string reason); + bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent, bool removeScripts); - ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); + ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx); bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c97c8380d4..e780f8607c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using PermissionMask = OpenSim.Framework.PermissionMask; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes { @@ -534,7 +535,8 @@ namespace OpenSim.Region.Framework.Scenes /// public bool IsAttachmentCheckFull() { - return (IsAttachment || (m_rootPart.Shape.PCode == (byte)PCodeEnum.Primitive && m_rootPart.Shape.State != 0)); + return (IsAttachment || + (m_rootPart.Shape.PCode == (byte)PCodeEnum.Primitive && m_rootPart.Shape.State != 0)); } private struct avtocrossInfo @@ -679,7 +681,7 @@ namespace OpenSim.Region.Framework.Scenes } string reason = String.Empty; - string version = String.Empty; + EntityTransferContext ctx = new EntityTransferContext(); foreach (ScenePresence av in sog.m_sittingAvatars) { @@ -691,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes // We set the avatar position as being the object // position to get the region to send to - if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, out version, out reason)) + if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) { return sog; } @@ -731,7 +733,7 @@ namespace OpenSim.Region.Framework.Scenes // CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; // d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); - entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, version); + entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx); if (av.IsChildAgent) { // avatar crossed do some extra cleanup diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 65511bce8a..52f9b51f6f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2121,8 +2121,9 @@ namespace OpenSim.Region.Framework.Scenes } else { - if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment - && !(Shape.PathCurve == (byte)Extrusion.Flexible)) + if ((!isPhantom || isPhysical || _VolumeDetectActive) + && !ParentGroup.IsAttachmentCheckFull() + && !(Shape.PathCurve == (byte)Extrusion.Flexible)) { AddToPhysics(isPhysical, isPhantom, building, isPhysical); UpdatePhysicsSubscribedEvents(); // not sure if appliable here diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 226ed6ee4c..b8f7458c3e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); } +/* [Test] public void TestSameSimulatorIsolatedRegionsV1() { @@ -136,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour - lscm.ServiceVersion = "SIMULATION/0.1"; + lscm.ServiceVersion = 0.1f; Vector3 teleportPosition = new Vector3(10, 11, 12); Vector3 teleportLookAt = new Vector3(20, 21, 22); @@ -178,6 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // position instead). // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); } +*/ [Test] public void TestSameSimulatorIsolatedRegionsV2() @@ -488,6 +490,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // TestHelpers.DisableLogging(); } +/* [Test] public void TestSameSimulatorNeighbouringRegionsV1() { @@ -519,7 +522,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour - lscm.ServiceVersion = "SIMULATION/0.1"; + lscm.ServiceVersion = 0.1f; Vector3 teleportPosition = new Vector3(10, 11, 12); Vector3 teleportLookAt = new Vector3(20, 21, 22); @@ -573,6 +576,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // TestHelpers.DisableLogging(); } +*/ [Test] public void TestSameSimulatorNeighbouringRegionsV2() diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs index c244f95d7e..b9cd6f5f3f 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs @@ -33,3 +33,4 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.8.3.*")] + diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index 743a6f6a15..61993872ae 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -172,7 +172,7 @@ namespace OpenSim.Region.PhysicsModule.ODE /// private void RayCast(ODERayCastRequest req) { - // NOTE: limit ray lenght or collisions will take all avaiable stack space + // NOTE: limit ray length or collisions will take all avaiable stack space // this value may still be too large, depending on machine configuration // of maximum stack float len = req.length; diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 30418bef76..0e6710d3e3 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -145,9 +145,90 @@ 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); + + float version = 0f; + + float outboundVersion = 0f; + float inboundVersion = 0f; + + if (minVersionProvided == 0f) // string version or older + { + // If there is no version in the packet at all we're looking at 0.6 or + // even more ancient. Refuse it. + if(theirVersion == 0f) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString("Your region is running a old version of opensim no longer supported. Consider updating it"); + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); + return; + } + + version = theirVersion; + + if (version < VersionInfo.SimulationServiceVersionAcceptedMin || + version > VersionInfo.SimulationServiceVersionAcceptedMax ) + { + resp["success"] = OSD.FromBoolean(false); + resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and we accept only {1} - {2}. No version overlap.", 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("Your region provide protocol 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 region protocol 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 versions to use + // This is intentionally inverted. Inbound and Outbound refer to the direction of the transfer. + // Therefore outbound means from the sender to the receier and inbound means from the receiver to the sender. + // So outbound is what we will accept and inbound is what we will send. Confused yet? + outboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); + inboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); + } List features = new List(); @@ -163,16 +244,25 @@ 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); + // We're sending the version numbers down to the local connector to do the varregion check. + EntityTransferContext ctx = new EntityTransferContext(); + ctx.InboundVersion = inboundVersion; + ctx.OutboundVersion = outboundVersion; + if (minVersionProvided == 0f) + { + ctx.InboundVersion = version; + ctx.OutboundVersion = version; + } - responsedata["int_response_code"] = HttpStatusCode.OK; - - OSDMap resp = new OSDMap(3); + bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, 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_inbound_version"] = OSD.FromReal(inboundVersion); + resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); + resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); OSDArray featuresWanted = new OSDArray(); foreach (UUID feature in features) diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 243da52f39..c7d658a2cc 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -524,7 +524,9 @@ namespace OpenSim.Services.Connectors { InventoryItemBase retrieved = null; if (m_ItemCache.TryGetValue(item.ID, out retrieved)) + { return retrieved; + } try { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 493d7e03e8..ebffa28673 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -283,11 +283,9 @@ 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, EntityTransferContext ctx, out string reason) { reason = "Failed to contact destination"; - version = "Unknown"; // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); @@ -300,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) @@ -324,15 +329,30 @@ 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(); + // We will need to plumb this and start sing the outbound version as well + // TODO: lay the pipe for version plumbing + if (data.ContainsKey("negotiated_inbound_version") && data["negotiated_inbound_version"] != null) + { + ctx.InboundVersion = (float)data["negotiated_inbound_version"].AsReal(); + ctx.OutboundVersion = (float)data["negotiated_outbound_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) + { + ctx.InboundVersion = float.Parse(parts[1]); + ctx.OutboundVersion = 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 {3}/{4}", + uri, success, reason, ctx.InboundVersion, ctx.OutboundVersion); } - if (!success) + if (!success || ctx.InboundVersion == 0f || ctx.OutboundVersion == 0f) { // If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the // actual failure message @@ -451,7 +471,6 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); - OSDMap result = WebUtil.PostToService(uri, args, 40000, false); if (result == null) diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index bee3db3ab0..692ef0652b 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -452,12 +452,12 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0}, Teleport Flags: {1}", aCircuit.Name, loginFlag); - string version; + EntityTransferContext ctx = new EntityTransferContext(); 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(), ctx, out reason)) return false; return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index 3663a7a896..bd66dad2a8 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs @@ -162,12 +162,11 @@ namespace OpenSim.Services.Interfaces } // Visual Params - // string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; - // byte[] binary = appearance.VisualParams; + //string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT]; + //byte[] binary = appearance.VisualParams; // for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++) - byte[] binary = appearance.VisualParams; string[] vps = new string[binary.Length]; @@ -285,14 +284,13 @@ namespace OpenSim.Services.Interfaces if (Data.ContainsKey("VisualParams")) { string[] vps = Data["VisualParams"].Split(new char[] {','}); - // byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; + //byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; - // for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) + //for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) byte[] binary = new byte[vps.Length]; for (int i = 0; i < vps.Length; i++) - - binary[i] = (byte)Convert.ToInt32(vps[i]); + binary[i] = (byte)Convert.ToInt32(vps[i]); appearance.VisualParams = binary; } diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 3573bea32c..257b578d83 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs @@ -34,6 +34,18 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Services.Interfaces { + public class EntityTransferContext + { + public EntityTransferContext() + { + InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax; + OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax; + } + + public float InboundVersion { get; set; } + public float OutboundVersion { get; set; } + } + public interface ISimulationService { /// @@ -93,7 +105,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, EntityTransferContext ctx, 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 5829212405..619a5273ec 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -993,11 +993,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; + EntityTransferContext ctx = new EntityTransferContext(); 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(), ctx, out reason)) return false; return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);