From eca6442bae4093019bd221e87413c74c77c4ff5d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 16 Jan 2009 21:56:13 +0000 Subject: * Rig up enough infrastructure to actually perform a successful 'standalone' teleport unit test with checks that the scene presence disappeared from sceneA and appeared in sceneB * However, I'm not convinced that the actual process in the test completely reflects reality, and a lot of stuff had to be rigged up (which should get resolved over time) --- OpenSim/Region/Environment/Scenes/Scene.cs | 11 +++++++++-- .../Region/Environment/Scenes/SceneCommunicationService.cs | 4 ++-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 6 +++--- OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs | 2 +- OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | 2 +- .../Environment/Scenes/Tests/StandaloneTeleportTests.cs | 10 ++++++++-- 6 files changed, 24 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 9c3aa96..8a9d295 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2777,7 +2777,7 @@ namespace OpenSim.Region.Environment.Scenes // Don't disable this log message - it's too helpful m_log.DebugFormat( - "[CONNECTION BEGIN]: Scene {0} told of incoming client {1} {2} {3} (circuit code {4})", + "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) @@ -2977,13 +2977,16 @@ namespace OpenSim.Region.Environment.Scenes public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) { - //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate FULL in " + RegionInfo.RegionName); +// m_log.DebugFormat( +// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); + ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { childAgentUpdate.ChildAgentDataUpdate(cAgentData); return true; } + return false; } @@ -3030,6 +3033,8 @@ namespace OpenSim.Region.Environment.Scenes /// public bool IncomingCloseAgent(UUID agentID) { + //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); + ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { @@ -3056,9 +3061,11 @@ namespace OpenSim.Region.Environment.Scenes else presence.ControllingClient.SendShutdownConnectionNotice(); } + presence.ControllingClient.Close(true); return true; } + // Agent not here return false; } diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 65e62ef..a46fa0b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -758,6 +758,7 @@ namespace OpenSim.Region.Environment.Scenes // both regions if (avatar.ParentID != (uint)0) avatar.StandUp(); + if (!avatar.ValidateAttachments()) { avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); @@ -772,13 +773,13 @@ namespace OpenSim.Region.Environment.Scenes // once we reach here... //avatar.Scene.RemoveCapsHandler(avatar.UUID); - string capsPath = String.Empty; AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo(); agentCircuit.BaseFolder = UUID.Zero; agentCircuit.InventoryFolder = UUID.Zero; agentCircuit.startpos = position; agentCircuit.child = true; + if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) { // brand new agent, let's create a new caps seed @@ -871,7 +872,6 @@ namespace OpenSim.Region.Environment.Scenes teleportFlags, capsPath); } - // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation // that the client contacted the destination before we send the attachments and close things here. diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index bdb0836..77d5b93 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1017,9 +1017,12 @@ namespace OpenSim.Region.Environment.Scenes if ((m_callbackURI != null) && !m_callbackURI.Equals("")) { + //m_log.DebugFormat("Found callback URI {0}", m_callbackURI); Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); m_callbackURI = null; } + + //m_log.DebugFormat("Completed movement"); } } @@ -2594,7 +2597,6 @@ namespace OpenSim.Region.Environment.Scenes /// public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) { - // if (!IsChildAgent) return; @@ -2615,7 +2617,6 @@ namespace OpenSim.Region.Environment.Scenes if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); - // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. if (m_scene.m_seeIntoRegionFromNeighbor) m_pendingObjects = null; @@ -2662,7 +2663,6 @@ namespace OpenSim.Region.Environment.Scenes cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; } - cAgent.GodLevel = (byte)m_godlevel; cAgent.AlwaysRun = m_setAlwaysRun; diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs index 548fea9..5ce78a3 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests agent.CapsPath = "http://wibble.com"; scene.NewUserConnection(agent); - scene.AddNewClient(new TestClient(agent)); + scene.AddNewClient(new TestClient(agent, scene)); ScenePresence presence = scene.GetScenePresence(agentId); diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 3c4049d..5fa897c 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests scene.NewUserConnection(agent); // Stage 2: add the new client as a child agent to the scene - TestClient client = new TestClient(agent); + TestClient client = new TestClient(agent, scene); scene.AddNewClient(client); // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, diff --git a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs index a3d116d..d7342de 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs @@ -27,6 +27,7 @@ using Nini.Config; using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -77,9 +78,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests TestClient client = SceneTestUtils.AddRootAgent(sceneA, agentId); - client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); + // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. + client.TeleportTargetScene = sceneB; - // TODO: Check that everything is as it should be + client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); + Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); + Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); + + // TODO: Check that more of everything is as it should be // TODO: test what happens if we try to teleport to a region that doesn't exist } -- cgit v1.1