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).
This commit is contained in:
Diva Canto
2013-07-25 23:44:58 -07:00
parent 4cd03d8c31
commit 878ce1e6b2
4 changed files with 54 additions and 87 deletions

View File

@@ -91,7 +91,6 @@ namespace OpenSim.Region.ClientStack.Linden
scene.RegisterModuleInterface<IEventQueue>(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<IEventQueue>(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<OSD>();
}
return queues[agentId];
}
}
@@ -228,8 +224,12 @@ namespace OpenSim.Region.ClientStack.Linden
{
Queue<OSD> 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);
}
/// <summary>
@@ -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<OSD> queue = TryGetQueue(pAgentId);
Queue<OSD> queue = GetQueue(pAgentId);
if (queue == null)
{
return NoEvents(requestID, pAgentId);
}
OSD element;
lock (queue)
{