From 9ec672c70b28b8c1d6d81bab7744fcf7bf9b83c7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 24 Oct 2011 23:16:03 +0100 Subject: Fix bugs in EventQueueGetModule.ClientClosed() and BaseHttpServer.RemovePollServerHTTPHandler() that stopped existing code in ClientClosed() from actually tearing down the poll handler Actually doing the tear down appear to have no ill effects with region crossing and teleport. --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 11 +++++++---- .../Linden/Caps/EventQueue/Tests/EventQueueTests.cs | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 3eb2b5e..7d73b3e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -204,7 +204,7 @@ namespace OpenSim.Region.ClientStack.Linden private void ClientClosed(UUID AgentID, Scene scene) { - //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); int count = 0; while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) @@ -216,11 +216,13 @@ namespace OpenSim.Region.ClientStack.Linden { queues.Remove(AgentID); } + List removeitems = new List(); lock (m_AvatarQueueUUIDMapping) { foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) { +// m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID); if (ky == AgentID) { removeitems.Add(ky); @@ -229,11 +231,13 @@ namespace OpenSim.Region.ClientStack.Linden foreach (UUID ky in removeitems) { + UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; m_AvatarQueueUUIDMapping.Remove(ky); - MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + ky.ToString() + "/"); - } + MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + eventQueueGetUuid.ToString() + "/"); + } } + UUID searchval = UUID.Zero; removeitems.Clear(); @@ -252,7 +256,6 @@ namespace OpenSim.Region.ClientStack.Linden foreach (UUID ky in removeitems) m_QueueUUIDAvatarMapping.Remove(ky); - } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index ec8a414..2ca02c5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs @@ -74,5 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden.Tests // TODO: Add more assertions for the other aspects of event queues Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(1)); } + + [Test] + public void RemoveForClient() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID spId = TestHelpers.ParseTail(0x1); + + SceneHelpers.AddScenePresence(m_scene, spId); + m_scene.IncomingCloseAgent(spId); + + // TODO: Add more assertions for the other aspects of event queues + Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); + } } } \ No newline at end of file -- cgit v1.1