aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-01-16 20:23:31 +0000
committerJustin Clark-Casey (justincc)2014-01-16 20:23:31 +0000
commit3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a (patch)
tree1aa231493524b52135ec2e5f52a7ed9b7369527c /OpenSim/Region/Framework/Scenes/Tests
parentCan delete the Offline Messages sent to/from a user. (diff)
downloadopensim-SC_OLD-3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a.zip
opensim-SC_OLD-3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a.tar.gz
opensim-SC_OLD-3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a.tar.bz2
opensim-SC_OLD-3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a.tar.xz
Prevent duplicate invocations or race dontision in SP.CompleteMovement()
This can happen under poor network conditions if a viewer repeats the message send If this happens, physics actors can get orphaned, which unecessarily raises physics frame times
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs92
1 files changed, 39 insertions, 53 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index d1aeaee..1ff1329 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -111,6 +111,45 @@ namespace OpenSim.Region.Framework.Scenes.Tests
111 Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1)); 111 Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
112 } 112 }
113 113
114 /// <summary>
115 /// Test that duplicate complete movement calls are ignored.
116 /// </summary>
117 /// <remarks>
118 /// If duplicate calls are not ignored then there is a risk of race conditions or other unexpected effects.
119 /// </remarks>
120 [Test]
121 public void TestDupeCompleteMovementCalls()
122 {
123 TestHelpers.InMethod();
124// TestHelpers.EnableLogging();
125
126 UUID spUuid = TestHelpers.ParseTail(0x1);
127
128 TestScene scene = new SceneHelpers().SetupScene();
129
130 int makeRootAgentEvents = 0;
131 scene.EventManager.OnMakeRootAgent += spi => makeRootAgentEvents++;
132
133 ScenePresence sp = SceneHelpers.AddScenePresence(scene, spUuid);
134
135 Assert.That(makeRootAgentEvents, Is.EqualTo(1));
136
137 // Normally these would be invoked by a CompleteMovement message coming in to the UDP stack. But for
138 // convenience, here we will invoke it manually.
139 sp.CompleteMovement(sp.ControllingClient, true);
140
141 Assert.That(makeRootAgentEvents, Is.EqualTo(1));
142
143 // Check rest of exepcted parameters.
144 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
145 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
146
147 Assert.That(sp.IsChildAgent, Is.False);
148 Assert.That(sp.UUID, Is.EqualTo(spUuid));
149
150 Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
151 }
152
114 [Test] 153 [Test]
115 public void TestCreateDuplicateRootScenePresence() 154 public void TestCreateDuplicateRootScenePresence()
116 { 155 {
@@ -249,58 +288,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
249// Assert.That(childPresence, Is.Not.Null); 288// Assert.That(childPresence, Is.Not.Null);
250// Assert.That(childPresence.IsChildAgent, Is.True); 289// Assert.That(childPresence.IsChildAgent, Is.True);
251 } 290 }
252
253// /// <summary>
254// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
255// /// </summary>
256// [Test]
257// public void T010_TestAddRootAgent()
258// {
259// TestHelpers.InMethod();
260//
261// string firstName = "testfirstname";
262//
263// AgentCircuitData agent = new AgentCircuitData();
264// agent.AgentID = agent1;
265// agent.firstname = firstName;
266// agent.lastname = "testlastname";
267// agent.SessionID = UUID.Random();
268// agent.SecureSessionID = UUID.Random();
269// agent.circuitcode = 123;
270// agent.BaseFolder = UUID.Zero;
271// agent.InventoryFolder = UUID.Zero;
272// agent.startpos = Vector3.Zero;
273// agent.CapsPath = GetRandomCapsObjectPath();
274// agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
275// agent.child = true;
276//
277// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
278//
279// string reason;
280// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
281// testclient = new TestClient(agent, scene);
282// scene.AddNewAgent(testclient);
283//
284// ScenePresence presence = scene.GetScenePresence(agent1);
285//
286// Assert.That(presence, Is.Not.Null, "presence is null");
287// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
288// acd1 = agent;
289// }
290//
291// /// <summary>
292// /// Test removing an uncrossed root agent from a scene.
293// /// </summary>
294// [Test]
295// public void T011_TestRemoveRootAgent()
296// {
297// TestHelpers.InMethod();
298//
299// scene.RemoveClient(agent1);
300//
301// ScenePresence presence = scene.GetScenePresence(agent1);
302//
303// Assert.That(presence, Is.Null, "presence is not null");
304// }
305 } 291 }
306} \ No newline at end of file 292} \ No newline at end of file