From d547bcf8d15bdcb8604cf170dc8ec1e14ad4cdc0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 8 Jun 2012 00:40:38 +0100 Subject: [PATCH 1/2] Remove duplicate update of user count in Scene.IncomingCloseAgent() This is already done in Scene.RemoveClient() which IncomingCloseAgent() always ends up calling. --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 -------- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 8 +++---- .../Tests/ScenePresenceTeleportTests.cs | 23 +++++++++++++++++++ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 17503b1e23..9048f00888 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4039,16 +4039,6 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { - // Nothing is removed here, so down count it as such - if (presence.IsChildAgent) - { - m_sceneGraph.removeUserCount(false); - } - else - { - m_sceneGraph.removeUserCount(true); - } - presence.ControllingClient.Close(); return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index ddf1550c0a..82a4f64040 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -703,10 +703,10 @@ namespace OpenSim.Region.Framework.Scenes public int GetChildAgentCount() { // some network situations come in where child agents get closed twice. - if (m_numChildAgents < 0) - { - m_numChildAgents = 0; - } +// if (m_numChildAgents < 0) +// { +// m_numChildAgents = 0; +// } return m_numChildAgents; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index ccfe4ff218..a407f01d63 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -97,6 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(scene.GetRootAgentCount(), Is.EqualTo(1)); + Assert.That(scene.GetChildAgentCount(), Is.EqualTo(0)); + // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera // position instead). // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); @@ -158,6 +161,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); + Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); + Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); + Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); + // TODO: Add assertions to check correct circuit details in both scenes. // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera @@ -235,6 +243,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); + Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); + Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); + Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); + // TODO: Add assertions to check correct circuit details in both scenes. // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera @@ -306,6 +319,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); + Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); + Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); + Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); + Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); + // TODO: Add assertions to check correct circuit details in both scenes. // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera @@ -382,6 +400,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); + Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); + Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); + Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); + Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); + // TODO: Add assertions to check correct circuit details in both scenes. // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera From 5c162ccd57639f0c711d9940ecdd3e2804d26304 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 8 Jun 2012 00:59:39 +0100 Subject: [PATCH 2/2] Go back to calling IncomingCloseAgent() in the "kick user" command for consistency instead of IClientAPI.Close() directly. This no longer double counts child agent removals --- OpenSim/Region/Application/OpenSim.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 1d0052290b..9c38ebedbe 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -486,7 +486,7 @@ namespace OpenSim else presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); - presence.ControllingClient.Close(); + presence.Scene.IncomingCloseAgent(presence.UUID); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 82a4f64040..a59758f5dc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -702,12 +702,6 @@ namespace OpenSim.Region.Framework.Scenes public int GetChildAgentCount() { - // some network situations come in where child agents get closed twice. -// if (m_numChildAgents < 0) -// { -// m_numChildAgents = 0; -// } - return m_numChildAgents; }