diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
5 files changed, 176 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4fa4a7c..56bdc63 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3862,21 +3862,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3862 | // In the case where, for example, an A B C D region layout, an avatar may | 3862 | // In the case where, for example, an A B C D region layout, an avatar may |
3863 | // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C | 3863 | // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C |
3864 | // renews the lease on the child agent at B, we must make sure that the close from A does not succeed. | 3864 | // renews the lease on the child agent at B, we must make sure that the close from A does not succeed. |
3865 | if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) | 3865 | // |
3866 | { | 3866 | // XXX: In the end, this should not be necessary if child agents are closed without delay on |
3867 | m_log.DebugFormat( | 3867 | // teleport, since realistically, the close request should always be processed before any other |
3868 | "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", | 3868 | // region tried to re-establish a child agent. This is much simpler since the logic below is |
3869 | sp.Name, Name); | 3869 | // vulnerable to an issue when a viewer quits a region without sending a proper logout but then |
3870 | // re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport | ||
3871 | // flag when no teleport had taken place (and hence no close was going to come). | ||
3872 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) | ||
3873 | // { | ||
3874 | // m_log.DebugFormat( | ||
3875 | // "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", | ||
3876 | // sp.Name, Name); | ||
3877 | // | ||
3878 | // sp.DoNotCloseAfterTeleport = true; | ||
3879 | // } | ||
3880 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) | ||
3870 | 3881 | ||
3871 | sp.DoNotCloseAfterTeleport = true; | 3882 | if (EntityTransferModule.IsInTransit(sp.UUID)) |
3872 | } | ||
3873 | else if (EntityTransferModule.IsInTransit(sp.UUID)) | ||
3874 | { | 3883 | { |
3884 | sp.DoNotCloseAfterTeleport = true; | ||
3885 | |||
3875 | m_log.DebugFormat( | 3886 | m_log.DebugFormat( |
3876 | "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt previous end-of-teleport close.", | 3887 | "[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt end-of-teleport close from a previous close.", |
3877 | sp.Name, Name); | 3888 | sp.Name, Name); |
3878 | |||
3879 | sp.DoNotCloseAfterTeleport = true; | ||
3880 | } | 3889 | } |
3881 | } | 3890 | } |
3882 | } | 3891 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5301a82..3f4979e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
223 | private float m_sitAvatarHeight = 2.0f; | 223 | private float m_sitAvatarHeight = 2.0f; |
224 | 224 | ||
225 | private Vector3 m_lastChildAgentUpdatePosition; | 225 | private Vector3 m_lastChildAgentUpdatePosition; |
226 | private Vector3 m_lastChildAgentUpdateCamPosition; | 226 | // private Vector3 m_lastChildAgentUpdateCamPosition; |
227 | 227 | ||
228 | private const int LAND_VELOCITYMAG_MAX = 12; | 228 | private const int LAND_VELOCITYMAG_MAX = 12; |
229 | 229 | ||
@@ -2108,8 +2108,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2108 | if (m_movementUpdateCount < 1) | 2108 | if (m_movementUpdateCount < 1) |
2109 | m_movementUpdateCount = 1; | 2109 | m_movementUpdateCount = 1; |
2110 | 2110 | ||
2111 | 2111 | // AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | |
2112 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | ||
2113 | 2112 | ||
2114 | // Camera location in world. We'll need to raytrace | 2113 | // Camera location in world. We'll need to raytrace |
2115 | // from this location from time to time. | 2114 | // from this location from time to time. |
@@ -3241,7 +3240,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3241 | if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance) | 3240 | if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance) |
3242 | { | 3241 | { |
3243 | m_lastChildAgentUpdatePosition = AbsolutePosition; | 3242 | m_lastChildAgentUpdatePosition = AbsolutePosition; |
3244 | m_lastChildAgentUpdateCamPosition = CameraPosition; | 3243 | // m_lastChildAgentUpdateCamPosition = CameraPosition; |
3245 | 3244 | ||
3246 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 3245 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); |
3247 | cadu.ActiveGroupID = UUID.Zero.Guid; | 3246 | cadu.ActiveGroupID = UUID.Zero.Guid; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index d670dad..5b5fb92 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
147 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB); | 147 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB); |
148 | TestClient clientB = new TestClient(acd, sceneB); | 148 | TestClient clientB = new TestClient(acd, sceneB); |
149 | List<TestClient> childClientsB = new List<TestClient>(); | 149 | List<TestClient> childClientsB = new List<TestClient>(); |
150 | EntityTransferHelpers.SetUpInformClientOfNeighbour(clientB, childClientsB); | 150 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(clientB, childClientsB); |
151 | 151 | ||
152 | SceneHelpers.AddScenePresence(sceneB, clientB, acd); | 152 | SceneHelpers.AddScenePresence(sceneB, clientB, acd); |
153 | 153 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs index 5df9aba..12a778b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs | |||
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
97 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | 97 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); |
98 | TestClient tc = new TestClient(acd, sceneA); | 98 | TestClient tc = new TestClient(acd, sceneA); |
99 | List<TestClient> destinationTestClients = new List<TestClient>(); | 99 | List<TestClient> destinationTestClients = new List<TestClient>(); |
100 | EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); | 100 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); |
101 | 101 | ||
102 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | 102 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); |
103 | originalSp.AbsolutePosition = new Vector3(128, 32, 10); | 103 | originalSp.AbsolutePosition = new Vector3(128, 32, 10); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index afd2779..8c25dbc 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using NUnit.Framework; | 35 | using NUnit.Framework; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -107,7 +108,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
107 | } | 108 | } |
108 | 109 | ||
109 | [Test] | 110 | [Test] |
110 | public void TestSameSimulatorIsolatedRegions() | 111 | public void TestSameSimulatorIsolatedRegionsV1() |
111 | { | 112 | { |
112 | TestHelpers.InMethod(); | 113 | TestHelpers.InMethod(); |
113 | // TestHelpers.EnableLogging(); | 114 | // TestHelpers.EnableLogging(); |
@@ -146,7 +147,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
146 | sp.AbsolutePosition = new Vector3(30, 31, 32); | 147 | sp.AbsolutePosition = new Vector3(30, 31, 32); |
147 | 148 | ||
148 | List<TestClient> destinationTestClients = new List<TestClient>(); | 149 | List<TestClient> destinationTestClients = new List<TestClient>(); |
149 | EntityTransferHelpers.SetUpInformClientOfNeighbour((TestClient)sp.ControllingClient, destinationTestClients); | 150 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate( |
151 | (TestClient)sp.ControllingClient, destinationTestClients); | ||
150 | 152 | ||
151 | sceneA.RequestTeleportLocation( | 153 | sceneA.RequestTeleportLocation( |
152 | sp.ControllingClient, | 154 | sp.ControllingClient, |
@@ -179,6 +181,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
179 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | 181 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); |
180 | } | 182 | } |
181 | 183 | ||
184 | [Test] | ||
185 | public void TestSameSimulatorIsolatedRegionsV2() | ||
186 | { | ||
187 | TestHelpers.InMethod(); | ||
188 | // TestHelpers.EnableLogging(); | ||
189 | |||
190 | UUID userId = TestHelpers.ParseTail(0x1); | ||
191 | |||
192 | EntityTransferModule etmA = new EntityTransferModule(); | ||
193 | EntityTransferModule etmB = new EntityTransferModule(); | ||
194 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
195 | |||
196 | IConfigSource config = new IniConfigSource(); | ||
197 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
198 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
199 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
200 | |||
201 | SceneHelpers sh = new SceneHelpers(); | ||
202 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
203 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
204 | |||
205 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
206 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
207 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
208 | |||
209 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
210 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
211 | |||
212 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); | ||
213 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
214 | |||
215 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
216 | EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( | ||
217 | (TestClient)sp.ControllingClient, destinationTestClients); | ||
218 | |||
219 | sceneA.RequestTeleportLocation( | ||
220 | sp.ControllingClient, | ||
221 | sceneB.RegionInfo.RegionHandle, | ||
222 | teleportPosition, | ||
223 | teleportLookAt, | ||
224 | (uint)TeleportFlags.ViaLocation); | ||
225 | |||
226 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | ||
227 | |||
228 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); | ||
229 | Assert.That(sceneBSp, Is.Not.Null); | ||
230 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
231 | Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
232 | |||
233 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | ||
234 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
235 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); | ||
236 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
237 | |||
238 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
239 | |||
240 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
241 | // position instead). | ||
242 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
243 | } | ||
244 | |||
182 | /// <summary> | 245 | /// <summary> |
183 | /// Test teleport procedures when the target simulator returns false when queried about access. | 246 | /// Test teleport procedures when the target simulator returns false when queried about access. |
184 | /// </summary> | 247 | /// </summary> |
@@ -428,7 +491,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
428 | } | 491 | } |
429 | 492 | ||
430 | [Test] | 493 | [Test] |
431 | public void TestSameSimulatorNeighbouringRegions() | 494 | public void TestSameSimulatorNeighbouringRegionsV1() |
432 | { | 495 | { |
433 | TestHelpers.InMethod(); | 496 | TestHelpers.InMethod(); |
434 | // TestHelpers.EnableLogging(); | 497 | // TestHelpers.EnableLogging(); |
@@ -466,7 +529,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
466 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | 529 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); |
467 | TestClient tc = new TestClient(acd, sceneA); | 530 | TestClient tc = new TestClient(acd, sceneA); |
468 | List<TestClient> destinationTestClients = new List<TestClient>(); | 531 | List<TestClient> destinationTestClients = new List<TestClient>(); |
469 | EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); | 532 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); |
470 | 533 | ||
471 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | 534 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); |
472 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); | 535 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); |
@@ -512,5 +575,89 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
512 | 575 | ||
513 | // TestHelpers.DisableLogging(); | 576 | // TestHelpers.DisableLogging(); |
514 | } | 577 | } |
578 | |||
579 | [Test] | ||
580 | public void TestSameSimulatorNeighbouringRegionsV2() | ||
581 | { | ||
582 | TestHelpers.InMethod(); | ||
583 | // TestHelpers.EnableLogging(); | ||
584 | |||
585 | UUID userId = TestHelpers.ParseTail(0x1); | ||
586 | |||
587 | EntityTransferModule etmA = new EntityTransferModule(); | ||
588 | EntityTransferModule etmB = new EntityTransferModule(); | ||
589 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
590 | |||
591 | IConfigSource config = new IniConfigSource(); | ||
592 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
593 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
594 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
595 | |||
596 | SceneHelpers sh = new SceneHelpers(); | ||
597 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
598 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | ||
599 | |||
600 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
601 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); | ||
602 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | ||
603 | |||
604 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
605 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
606 | |||
607 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
608 | TestClient tc = new TestClient(acd, sceneA); | ||
609 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
610 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); | ||
611 | |||
612 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
613 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); | ||
614 | |||
615 | Assert.That(beforeSceneASp, Is.Not.Null); | ||
616 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); | ||
617 | |||
618 | ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId); | ||
619 | Assert.That(beforeSceneBSp, Is.Not.Null); | ||
620 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); | ||
621 | |||
622 | // Here, we need to make clientA's receipt of SendRegionTeleport trigger clientB's CompleteMovement(). This | ||
623 | // is to operate the teleport V2 mechanism where the EntityTransferModule will first request the client to | ||
624 | // CompleteMovement to the region and then call UpdateAgent to the destination region to confirm the receipt | ||
625 | // Both these operations will occur on different threads and will wait for each other. | ||
626 | // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1 | ||
627 | // test protocol, where we are trying to avoid unpredictable async operations in regression tests. | ||
628 | tc.OnTestClientSendRegionTeleport | ||
629 | += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) | ||
630 | => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null); | ||
631 | |||
632 | sceneA.RequestTeleportLocation( | ||
633 | beforeSceneASp.ControllingClient, | ||
634 | sceneB.RegionInfo.RegionHandle, | ||
635 | teleportPosition, | ||
636 | teleportLookAt, | ||
637 | (uint)TeleportFlags.ViaLocation); | ||
638 | |||
639 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | ||
640 | Assert.That(afterSceneASp, Is.Not.Null); | ||
641 | Assert.That(afterSceneASp.IsChildAgent, Is.True); | ||
642 | |||
643 | ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId); | ||
644 | Assert.That(afterSceneBSp, Is.Not.Null); | ||
645 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); | ||
646 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
647 | Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
648 | |||
649 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | ||
650 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); | ||
651 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); | ||
652 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
653 | |||
654 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
655 | |||
656 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
657 | // position instead). | ||
658 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
659 | |||
660 | // TestHelpers.DisableLogging(); | ||
661 | } | ||
515 | } | 662 | } |
516 | } \ No newline at end of file | 663 | } \ No newline at end of file |