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).TeleportWork
parent
4cd03d8c31
commit
878ce1e6b2
|
@ -91,7 +91,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
scene.RegisterModuleInterface<IEventQueue>(this);
|
scene.RegisterModuleInterface<IEventQueue>(this);
|
||||||
|
|
||||||
scene.EventManager.OnClientClosed += ClientClosed;
|
scene.EventManager.OnClientClosed += ClientClosed;
|
||||||
scene.EventManager.OnMakeChildAgent += MakeChildAgent;
|
|
||||||
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand(
|
MainConsole.Instance.Commands.AddCommand(
|
||||||
|
@ -120,7 +119,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scene.EventManager.OnClientClosed -= ClientClosed;
|
scene.EventManager.OnClientClosed -= ClientClosed;
|
||||||
scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
|
|
||||||
scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||||
|
|
||||||
scene.UnregisterModuleInterface<IEventQueue>(this);
|
scene.UnregisterModuleInterface<IEventQueue>(this);
|
||||||
|
@ -189,11 +187,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
if (!queues.ContainsKey(agentId))
|
if (!queues.ContainsKey(agentId))
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
|
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
|
||||||
agentId, m_scene.RegionInfo.RegionName);
|
agentId, m_scene.RegionInfo.RegionName);
|
||||||
*/
|
|
||||||
queues[agentId] = new Queue<OSD>();
|
queues[agentId] = new Queue<OSD>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,9 +224,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
Queue<OSD> queue = GetQueue(avatarID);
|
Queue<OSD> queue = GetQueue(avatarID);
|
||||||
if (queue != null)
|
if (queue != null)
|
||||||
|
{
|
||||||
lock (queue)
|
lock (queue)
|
||||||
queue.Enqueue(ev);
|
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)
|
catch (NullReferenceException e)
|
||||||
{
|
{
|
||||||
m_log.Error("[EVENTQUEUE] Caught exception: " + e);
|
m_log.Error("[EVENTQUEUE] Caught exception: " + e);
|
||||||
|
@ -244,7 +244,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
private void ClientClosed(UUID agentID, Scene scene)
|
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;
|
int count = 0;
|
||||||
while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5)
|
while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5)
|
||||||
|
@ -261,31 +261,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
lock (m_AvatarQueueUUIDMapping)
|
lock (m_AvatarQueueUUIDMapping)
|
||||||
m_AvatarQueueUUIDMapping.Remove(agentID);
|
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;
|
UUID searchval = UUID.Zero;
|
||||||
|
|
||||||
removeitems.Clear();
|
removeitems.Clear();
|
||||||
|
@ -305,19 +280,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
foreach (UUID ky in removeitems)
|
foreach (UUID ky in removeitems)
|
||||||
m_QueueUUIDAvatarMapping.Remove(ky);
|
m_QueueUUIDAvatarMapping.Remove(ky);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void MakeChildAgent(ScenePresence avatar)
|
// m_log.DebugFormat("[EVENTQUEUE]: Deleted queues for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
|
||||||
{
|
|
||||||
//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;
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -417,7 +382,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
if (DebugLevel >= 2)
|
if (DebugLevel >= 2)
|
||||||
m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName);
|
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;
|
OSD element;
|
||||||
lock (queue)
|
lock (queue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,13 +132,9 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
{
|
{
|
||||||
Caps oldCaps = m_capsObjects[agentId];
|
Caps oldCaps = m_capsObjects[agentId];
|
||||||
|
|
||||||
m_log.DebugFormat(
|
//m_log.WarnFormat(
|
||||||
"[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ",
|
// "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
|
||||||
agentId, oldCaps.CapsObjectPath, capsObjectPath);
|
// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
|
||||||
// This should not happen. The caller code is confused. We need to fix that.
|
|
||||||
// CAPs can never be reregistered, or the client will be confused.
|
|
||||||
// Hence this return here.
|
|
||||||
//return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
||||||
|
@ -153,6 +149,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
|
|
||||||
public void RemoveCaps(UUID agentId)
|
public void RemoveCaps(UUID agentId)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[CAPS]: Remove caps for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName);
|
||||||
lock (m_childrenSeeds)
|
lock (m_childrenSeeds)
|
||||||
{
|
{
|
||||||
if (m_childrenSeeds.ContainsKey(agentId))
|
if (m_childrenSeeds.ContainsKey(agentId))
|
||||||
|
|
|
@ -317,6 +317,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.",
|
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.",
|
||||||
sp.Name, sp.UUID, position, regionHandle);
|
sp.Name, sp.UUID, position, regionHandle);
|
||||||
|
|
||||||
|
sp.ControllingClient.SendTeleportFailed("Slow down!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,9 +1041,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// Now let's make it officially a child agent
|
// Now let's make it officially a child agent
|
||||||
sp.MakeChildAgent();
|
sp.MakeChildAgent();
|
||||||
|
|
||||||
// OK, it got this agent. Let's close some child agents
|
|
||||||
sp.CloseChildAgents(newRegionX, newRegionY);
|
|
||||||
|
|
||||||
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
|
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
|
||||||
|
|
||||||
if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
|
if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
|
||||||
|
@ -1059,10 +1057,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
if (!sp.DoNotCloseAfterTeleport)
|
if (!sp.DoNotCloseAfterTeleport)
|
||||||
{
|
{
|
||||||
|
// OK, it got this agent. Let's close everything
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing in agent {0} in region {1}", sp.Name, Scene.RegionInfo.RegionName);
|
||||||
|
sp.CloseChildAgents(newRegionX, newRegionY);
|
||||||
sp.Scene.IncomingCloseAgent(sp.UUID, false);
|
sp.Scene.IncomingCloseAgent(sp.UUID, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {0}", sp.Name, Scene.RegionInfo.RegionName);
|
||||||
sp.DoNotCloseAfterTeleport = false;
|
sp.DoNotCloseAfterTeleport = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2805,6 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
bool vialogin;
|
bool vialogin;
|
||||||
|
bool reallyNew = true;
|
||||||
|
|
||||||
// Validation occurs in LLUDPServer
|
// Validation occurs in LLUDPServer
|
||||||
//
|
//
|
||||||
|
@ -2856,6 +2857,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
|
"[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
|
||||||
sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName);
|
sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName);
|
||||||
|
reallyNew = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
|
// We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
|
||||||
|
@ -2867,7 +2869,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// places. However, we still need to do it here for NPCs.
|
// places. However, we still need to do it here for NPCs.
|
||||||
CacheUserName(sp, aCircuit);
|
CacheUserName(sp, aCircuit);
|
||||||
|
|
||||||
|
if (reallyNew)
|
||||||
EventManager.TriggerOnNewClient(client);
|
EventManager.TriggerOnNewClient(client);
|
||||||
|
|
||||||
if (vialogin)
|
if (vialogin)
|
||||||
EventManager.TriggerOnClientLogin(client);
|
EventManager.TriggerOnClientLogin(client);
|
||||||
}
|
}
|
||||||
|
@ -3426,16 +3430,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (closeChildAgents && isChildAgent)
|
if (closeChildAgents && isChildAgent)
|
||||||
{
|
{
|
||||||
// Tell a single agent to disconnect from the region.
|
// Tell a single agent to disconnect from the region.
|
||||||
IEventQueue eq = RequestModuleInterface<IEventQueue>();
|
// Let's do this via UDP
|
||||||
if (eq != null)
|
|
||||||
{
|
|
||||||
eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
avatar.ControllingClient.SendShutdownConnectionNotice();
|
avatar.ControllingClient.SendShutdownConnectionNotice();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Only applies to root agents.
|
// Only applies to root agents.
|
||||||
if (avatar.ParentID != 0)
|
if (avatar.ParentID != 0)
|
||||||
|
@ -3685,6 +3682,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
if (!sp.IsChildAgent)
|
if (!sp.IsChildAgent)
|
||||||
|
{
|
||||||
|
// We have a root agent. Is it in transit?
|
||||||
|
if (!EntityTransferModule.IsInTransit(sp.UUID))
|
||||||
{
|
{
|
||||||
// We have a zombie from a crashed session.
|
// We have a zombie from a crashed session.
|
||||||
// Or the same user is trying to be root twice here, won't work.
|
// Or the same user is trying to be root twice here, won't work.
|
||||||
|
@ -3698,9 +3698,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
sp = null;
|
sp = null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[SCENE]: Existing root scene presence for {0} {1} in {2}, but agent is in trasit", sp.Name, sp.UUID, RegionInfo.RegionName);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// We have a child agent here
|
||||||
sp.DoNotCloseAfterTeleport = true;
|
sp.DoNotCloseAfterTeleport = true;
|
||||||
|
//m_log.WarnFormat("[SCENE]: Existing child scene presence for {0} {1} in {2}", sp.Name, sp.UUID, RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3787,7 +3792,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sp.AdjustKnownSeeds();
|
sp.AdjustKnownSeeds();
|
||||||
|
|
||||||
if (CapsModule != null)
|
if (CapsModule != null)
|
||||||
|
{
|
||||||
CapsModule.SetAgentCapsSeeds(agent);
|
CapsModule.SetAgentCapsSeeds(agent);
|
||||||
|
CapsModule.CreateCaps(agent.AgentID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5545,17 +5553,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
reason = "You are banned from the region";
|
reason = "You are banned from the region";
|
||||||
|
|
||||||
if (EntityTransferModule.IsInTransit(agentID))
|
|
||||||
{
|
|
||||||
reason = "Agent is still in transit from this region";
|
|
||||||
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[SCENE]: Denying agent {0} entry into {1} since region still has them registered as in transit",
|
|
||||||
agentID, RegionInfo.RegionName);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Permissions.IsGod(agentID))
|
if (Permissions.IsGod(agentID))
|
||||||
{
|
{
|
||||||
reason = String.Empty;
|
reason = String.Empty;
|
||||||
|
|
Loading…
Reference in New Issue