aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-29 23:22:40 +0000
committerJustin Clark-Casey (justincc)2012-10-29 23:22:40 +0000
commit09f4e72d6af4b86238af516b1719ff4f63aa7174 (patch)
treeb374a183a3610509af839c5b514d4d1eabc6902f /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-09f4e72d6af4b86238af516b1719ff4f63aa7174.zip
opensim-SC-09f4e72d6af4b86238af516b1719ff4f63aa7174.tar.gz
opensim-SC-09f4e72d6af4b86238af516b1719ff4f63aa7174.tar.bz2
opensim-SC-09f4e72d6af4b86238af516b1719ff4f63aa7174.tar.xz
Fix memory leak where removing an NPC did not remove its circuits.
This was because we were removing by circuitcode where NPCs have no code. Now removing by agent ID instead. This commit also fixes the "show circuits" console command to work properly where the circuit has no associated IP address.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs11
3 files changed, 15 insertions, 3 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index b24641a..2236e43 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -1111,7 +1111,7 @@ namespace OpenSim
1111 aCircuit.Name, 1111 aCircuit.Name,
1112 aCircuit.child ? "child" : "root", 1112 aCircuit.child ? "child" : "root",
1113 aCircuit.circuitcode.ToString(), 1113 aCircuit.circuitcode.ToString(),
1114 aCircuit.IPAddress.ToString(), 1114 aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set",
1115 aCircuit.Viewer); 1115 aCircuit.Viewer);
1116 }); 1116 });
1117 1117
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2cdc4b3..7d8cbf5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3384,9 +3384,10 @@ namespace OpenSim.Region.Framework.Scenes
3384 } 3384 }
3385 else 3385 else
3386 { 3386 {
3387 // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred 3387 // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred
3388 // simultaneously. 3388 // simultaneously.
3389 m_authenticateHandler.RemoveCircuit(acd.circuitcode); 3389 // We also need to remove by agent ID since NPCs will have no circuit code.
3390 m_authenticateHandler.RemoveCircuit(agentID);
3390 } 3391 }
3391 } 3392 }
3392 3393
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 9179966..52ed846 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -117,6 +117,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
117 Assert.That(npc, Is.Not.Null); 117 Assert.That(npc, Is.Not.Null);
118 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); 118 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
119 Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); 119 Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
120
121 IClientAPI client;
122 Assert.That(m_scene.TryGetClient(npcId, out client), Is.True);
123
124 // Have to account for both SP and NPC.
125 Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(2));
120 } 126 }
121 127
122 [Test] 128 [Test]
@@ -136,6 +142,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
136 ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); 142 ScenePresence deletedNpc = m_scene.GetScenePresence(npcId);
137 143
138 Assert.That(deletedNpc, Is.Null); 144 Assert.That(deletedNpc, Is.Null);
145 IClientAPI client;
146 Assert.That(m_scene.TryGetClient(npcId, out client), Is.False);
147
148 // Have to account for SP still present.
149 Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
139 } 150 }
140 151
141 [Test] 152 [Test]