From 878ce1e6b2b96043052015732286141f5b71310b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 25 Jul 2013 23:44:58 -0700 Subject: This should fix all issues with teleports. One should be able to TP as fast as needed. (Although sometimes Justin's state machine kicks in and doesn't let you) The EventQueues are a hairy mess, and it's very easy to mess things up. But it looks like this commit makes them work right. Here's what's going on: - Child and root agents are only closed after 15 sec, maybe - If the user comes back, they aren't closed, and everything is reused - On the receiving side, clients and scene presences are reused if they already exist - Caps are always recreated (this is where I spent most of my time!). It turns out that, because the agents carry the seeds around, the seed gets the same URL, except for the root agent coming back to a far away region, which gets a new seed (because we don't know what was its seed in the departing region, and we can't send it back to the client when the agent returns there). --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 58 ++++++---------------- 1 file changed, 14 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index c5e28ad..d02496f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -91,7 +91,6 @@ namespace OpenSim.Region.ClientStack.Linden scene.RegisterModuleInterface(this); scene.EventManager.OnClientClosed += ClientClosed; - scene.EventManager.OnMakeChildAgent += MakeChildAgent; scene.EventManager.OnRegisterCaps += OnRegisterCaps; MainConsole.Instance.Commands.AddCommand( @@ -120,7 +119,6 @@ namespace OpenSim.Region.ClientStack.Linden return; scene.EventManager.OnClientClosed -= ClientClosed; - scene.EventManager.OnMakeChildAgent -= MakeChildAgent; scene.EventManager.OnRegisterCaps -= OnRegisterCaps; scene.UnregisterModuleInterface(this); @@ -189,14 +187,12 @@ namespace OpenSim.Region.ClientStack.Linden { if (!queues.ContainsKey(agentId)) { - /* m_log.DebugFormat( "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); - */ queues[agentId] = new Queue(); } - + return queues[agentId]; } } @@ -228,8 +224,12 @@ namespace OpenSim.Region.ClientStack.Linden { Queue queue = GetQueue(avatarID); if (queue != null) + { lock (queue) queue.Enqueue(ev); + } + else + m_log.WarnFormat("[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName); } catch (NullReferenceException e) { @@ -244,7 +244,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) @@ -261,31 +261,6 @@ namespace OpenSim.Region.ClientStack.Linden lock (m_AvatarQueueUUIDMapping) m_AvatarQueueUUIDMapping.Remove(agentID); -// 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); -// } -// } -// -// foreach (UUID ky in removeitems) -// { -// UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; -// m_AvatarQueueUUIDMapping.Remove(ky); -// -// string eqgPath = GenerateEqgCapPath(eventQueueGetUuid); -// MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath); -// -//// m_log.DebugFormat( -//// "[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1} in {2}", -//// eqgPath, agentID, m_scene.RegionInfo.RegionName); -// } -// } - UUID searchval = UUID.Zero; removeitems.Clear(); @@ -305,19 +280,9 @@ namespace OpenSim.Region.ClientStack.Linden foreach (UUID ky in removeitems) m_QueueUUIDAvatarMapping.Remove(ky); } - } - private void MakeChildAgent(ScenePresence avatar) - { - //m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0} in region {1}.", avatar.UUID, m_scene.RegionInfo.RegionName); - //lock (m_ids) - // { - //if (m_ids.ContainsKey(avatar.UUID)) - //{ - // close the event queue. - //m_ids[avatar.UUID] = -1; - //} - //} + // m_log.DebugFormat("[EVENTQUEUE]: Deleted queues for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); + } /// @@ -417,7 +382,12 @@ namespace OpenSim.Region.ClientStack.Linden if (DebugLevel >= 2) m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName); - Queue queue = TryGetQueue(pAgentId); + Queue queue = GetQueue(pAgentId); + if (queue == null) + { + return NoEvents(requestID, pAgentId); + } + OSD element; lock (queue) { -- cgit v1.1