diff options
author | Diva Canto | 2013-07-25 23:44:58 -0700 |
---|---|---|
committer | Diva Canto | 2013-07-25 23:44:58 -0700 |
commit | 878ce1e6b2b96043052015732286141f5b71310b (patch) | |
tree | 62586d92078480f05d47b25aaf5c460310c12cfe | |
parent | Return Simulator/0.1 (V1) entity transfer behaviour to waiting only 2 seconds... (diff) | |
download | opensim-SC_OLD-878ce1e6b2b96043052015732286141f5b71310b.zip opensim-SC_OLD-878ce1e6b2b96043052015732286141f5b71310b.tar.gz opensim-SC_OLD-878ce1e6b2b96043052015732286141f5b71310b.tar.bz2 opensim-SC_OLD-878ce1e6b2b96043052015732286141f5b71310b.tar.xz |
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).
4 files changed, 54 insertions, 87 deletions
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 | |||
91 | scene.RegisterModuleInterface<IEventQueue>(this); | 91 | scene.RegisterModuleInterface<IEventQueue>(this); |
92 | 92 | ||
93 | scene.EventManager.OnClientClosed += ClientClosed; | 93 | scene.EventManager.OnClientClosed += ClientClosed; |
94 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | ||
95 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | 94 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
96 | 95 | ||
97 | MainConsole.Instance.Commands.AddCommand( | 96 | MainConsole.Instance.Commands.AddCommand( |
@@ -120,7 +119,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
120 | return; | 119 | return; |
121 | 120 | ||
122 | scene.EventManager.OnClientClosed -= ClientClosed; | 121 | scene.EventManager.OnClientClosed -= ClientClosed; |
123 | scene.EventManager.OnMakeChildAgent -= MakeChildAgent; | ||
124 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | 122 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; |
125 | 123 | ||
126 | scene.UnregisterModuleInterface<IEventQueue>(this); | 124 | scene.UnregisterModuleInterface<IEventQueue>(this); |
@@ -189,14 +187,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
189 | { | 187 | { |
190 | if (!queues.ContainsKey(agentId)) | 188 | if (!queues.ContainsKey(agentId)) |
191 | { | 189 | { |
192 | /* | ||
193 | m_log.DebugFormat( | 190 | m_log.DebugFormat( |
194 | "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", | 191 | "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", |
195 | agentId, m_scene.RegionInfo.RegionName); | 192 | agentId, m_scene.RegionInfo.RegionName); |
196 | */ | ||
197 | queues[agentId] = new Queue<OSD>(); | 193 | queues[agentId] = new Queue<OSD>(); |
198 | } | 194 | } |
199 | 195 | ||
200 | return queues[agentId]; | 196 | return queues[agentId]; |
201 | } | 197 | } |
202 | } | 198 | } |
@@ -228,8 +224,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
228 | { | 224 | { |
229 | Queue<OSD> queue = GetQueue(avatarID); | 225 | Queue<OSD> queue = GetQueue(avatarID); |
230 | if (queue != null) | 226 | if (queue != null) |
227 | { | ||
231 | lock (queue) | 228 | lock (queue) |
232 | queue.Enqueue(ev); | 229 | queue.Enqueue(ev); |
230 | } | ||
231 | else | ||
232 | m_log.WarnFormat("[EVENTQUEUE]: (Enqueue) No queue found for agent {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName); | ||
233 | } | 233 | } |
234 | catch (NullReferenceException e) | 234 | catch (NullReferenceException e) |
235 | { | 235 | { |
@@ -244,7 +244,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
244 | 244 | ||
245 | private void ClientClosed(UUID agentID, Scene scene) | 245 | private void ClientClosed(UUID agentID, Scene scene) |
246 | { | 246 | { |
247 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); | 247 | //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); |
248 | 248 | ||
249 | int count = 0; | 249 | int count = 0; |
250 | while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5) | 250 | while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5) |
@@ -261,31 +261,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
261 | lock (m_AvatarQueueUUIDMapping) | 261 | lock (m_AvatarQueueUUIDMapping) |
262 | m_AvatarQueueUUIDMapping.Remove(agentID); | 262 | m_AvatarQueueUUIDMapping.Remove(agentID); |
263 | 263 | ||
264 | // lock (m_AvatarQueueUUIDMapping) | ||
265 | // { | ||
266 | // foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) | ||
267 | // { | ||
268 | //// m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID); | ||
269 | // if (ky == agentID) | ||
270 | // { | ||
271 | // removeitems.Add(ky); | ||
272 | // } | ||
273 | // } | ||
274 | // | ||
275 | // foreach (UUID ky in removeitems) | ||
276 | // { | ||
277 | // UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; | ||
278 | // m_AvatarQueueUUIDMapping.Remove(ky); | ||
279 | // | ||
280 | // string eqgPath = GenerateEqgCapPath(eventQueueGetUuid); | ||
281 | // MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath); | ||
282 | // | ||
283 | //// m_log.DebugFormat( | ||
284 | //// "[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1} in {2}", | ||
285 | //// eqgPath, agentID, m_scene.RegionInfo.RegionName); | ||
286 | // } | ||
287 | // } | ||
288 | |||
289 | UUID searchval = UUID.Zero; | 264 | UUID searchval = UUID.Zero; |
290 | 265 | ||
291 | removeitems.Clear(); | 266 | removeitems.Clear(); |
@@ -305,19 +280,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
305 | foreach (UUID ky in removeitems) | 280 | foreach (UUID ky in removeitems) |
306 | m_QueueUUIDAvatarMapping.Remove(ky); | 281 | m_QueueUUIDAvatarMapping.Remove(ky); |
307 | } | 282 | } |
308 | } | ||
309 | 283 | ||
310 | private void MakeChildAgent(ScenePresence avatar) | 284 | // m_log.DebugFormat("[EVENTQUEUE]: Deleted queues for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); |
311 | { | 285 | |
312 | //m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0} in region {1}.", avatar.UUID, m_scene.RegionInfo.RegionName); | ||
313 | //lock (m_ids) | ||
314 | // { | ||
315 | //if (m_ids.ContainsKey(avatar.UUID)) | ||
316 | //{ | ||
317 | // close the event queue. | ||
318 | //m_ids[avatar.UUID] = -1; | ||
319 | //} | ||
320 | //} | ||
321 | } | 286 | } |
322 | 287 | ||
323 | /// <summary> | 288 | /// <summary> |
@@ -417,7 +382,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
417 | if (DebugLevel >= 2) | 382 | if (DebugLevel >= 2) |
418 | m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName); | 383 | m_log.WarnFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName); |
419 | 384 | ||
420 | Queue<OSD> queue = TryGetQueue(pAgentId); | 385 | Queue<OSD> queue = GetQueue(pAgentId); |
386 | if (queue == null) | ||
387 | { | ||
388 | return NoEvents(requestID, pAgentId); | ||
389 | } | ||
390 | |||
421 | OSD element; | 391 | OSD element; |
422 | lock (queue) | 392 | lock (queue) |
423 | { | 393 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index ad1c4ce..6545a99 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -132,13 +132,9 @@ namespace OpenSim.Region.CoreModules.Framework | |||
132 | { | 132 | { |
133 | Caps oldCaps = m_capsObjects[agentId]; | 133 | Caps oldCaps = m_capsObjects[agentId]; |
134 | 134 | ||
135 | m_log.DebugFormat( | 135 | //m_log.WarnFormat( |
136 | "[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ", | 136 | // "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", |
137 | agentId, oldCaps.CapsObjectPath, capsObjectPath); | 137 | // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); |
138 | // This should not happen. The caller code is confused. We need to fix that. | ||
139 | // CAPs can never be reregistered, or the client will be confused. | ||
140 | // Hence this return here. | ||
141 | //return; | ||
142 | } | 138 | } |
143 | 139 | ||
144 | caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, | 140 | caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, |
@@ -153,6 +149,7 @@ namespace OpenSim.Region.CoreModules.Framework | |||
153 | 149 | ||
154 | public void RemoveCaps(UUID agentId) | 150 | public void RemoveCaps(UUID agentId) |
155 | { | 151 | { |
152 | m_log.DebugFormat("[CAPS]: Remove caps for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); | ||
156 | lock (m_childrenSeeds) | 153 | lock (m_childrenSeeds) |
157 | { | 154 | { |
158 | if (m_childrenSeeds.ContainsKey(agentId)) | 155 | if (m_childrenSeeds.ContainsKey(agentId)) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3f1686c..96cd6b9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -316,7 +316,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
316 | m_log.DebugFormat( | 316 | m_log.DebugFormat( |
317 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.", | 317 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.", |
318 | sp.Name, sp.UUID, position, regionHandle); | 318 | sp.Name, sp.UUID, position, regionHandle); |
319 | 319 | ||
320 | sp.ControllingClient.SendTeleportFailed("Slow down!"); | ||
320 | return; | 321 | return; |
321 | } | 322 | } |
322 | 323 | ||
@@ -1040,9 +1041,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1040 | // Now let's make it officially a child agent | 1041 | // Now let's make it officially a child agent |
1041 | sp.MakeChildAgent(); | 1042 | sp.MakeChildAgent(); |
1042 | 1043 | ||
1043 | // OK, it got this agent. Let's close some child agents | ||
1044 | sp.CloseChildAgents(newRegionX, newRegionY); | ||
1045 | |||
1046 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1044 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1047 | 1045 | ||
1048 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 1046 | if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
@@ -1059,10 +1057,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1059 | 1057 | ||
1060 | if (!sp.DoNotCloseAfterTeleport) | 1058 | if (!sp.DoNotCloseAfterTeleport) |
1061 | { | 1059 | { |
1060 | // OK, it got this agent. Let's close everything | ||
1061 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Closing in agent {0} in region {1}", sp.Name, Scene.RegionInfo.RegionName); | ||
1062 | sp.CloseChildAgents(newRegionX, newRegionY); | ||
1062 | sp.Scene.IncomingCloseAgent(sp.UUID, false); | 1063 | sp.Scene.IncomingCloseAgent(sp.UUID, false); |
1064 | |||
1063 | } | 1065 | } |
1064 | else | 1066 | else |
1065 | { | 1067 | { |
1068 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Not closing agent {0}, user is back in {0}", sp.Name, Scene.RegionInfo.RegionName); | ||
1066 | sp.DoNotCloseAfterTeleport = false; | 1069 | sp.DoNotCloseAfterTeleport = false; |
1067 | } | 1070 | } |
1068 | } | 1071 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 705660d..6d0b13f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2805,6 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2805 | { | 2805 | { |
2806 | ScenePresence sp; | 2806 | ScenePresence sp; |
2807 | bool vialogin; | 2807 | bool vialogin; |
2808 | bool reallyNew = true; | ||
2808 | 2809 | ||
2809 | // Validation occurs in LLUDPServer | 2810 | // Validation occurs in LLUDPServer |
2810 | // | 2811 | // |
@@ -2856,6 +2857,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2856 | m_log.WarnFormat( | 2857 | m_log.WarnFormat( |
2857 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | 2858 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", |
2858 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 2859 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); |
2860 | reallyNew = false; | ||
2859 | } | 2861 | } |
2860 | 2862 | ||
2861 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | 2863 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the |
@@ -2867,7 +2869,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2867 | // places. However, we still need to do it here for NPCs. | 2869 | // places. However, we still need to do it here for NPCs. |
2868 | CacheUserName(sp, aCircuit); | 2870 | CacheUserName(sp, aCircuit); |
2869 | 2871 | ||
2870 | EventManager.TriggerOnNewClient(client); | 2872 | if (reallyNew) |
2873 | EventManager.TriggerOnNewClient(client); | ||
2874 | |||
2871 | if (vialogin) | 2875 | if (vialogin) |
2872 | EventManager.TriggerOnClientLogin(client); | 2876 | EventManager.TriggerOnClientLogin(client); |
2873 | } | 2877 | } |
@@ -3426,15 +3430,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3426 | if (closeChildAgents && isChildAgent) | 3430 | if (closeChildAgents && isChildAgent) |
3427 | { | 3431 | { |
3428 | // Tell a single agent to disconnect from the region. | 3432 | // Tell a single agent to disconnect from the region. |
3429 | IEventQueue eq = RequestModuleInterface<IEventQueue>(); | 3433 | // Let's do this via UDP |
3430 | if (eq != null) | 3434 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
3431 | { | ||
3432 | eq.DisableSimulator(RegionInfo.RegionHandle, avatar.UUID); | ||
3433 | } | ||
3434 | else | ||
3435 | { | ||
3436 | avatar.ControllingClient.SendShutdownConnectionNotice(); | ||
3437 | } | ||
3438 | } | 3435 | } |
3439 | 3436 | ||
3440 | // Only applies to root agents. | 3437 | // Only applies to root agents. |
@@ -3686,21 +3683,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3686 | { | 3683 | { |
3687 | if (!sp.IsChildAgent) | 3684 | if (!sp.IsChildAgent) |
3688 | { | 3685 | { |
3689 | // We have a zombie from a crashed session. | 3686 | // We have a root agent. Is it in transit? |
3690 | // Or the same user is trying to be root twice here, won't work. | 3687 | if (!EntityTransferModule.IsInTransit(sp.UUID)) |
3691 | // Kill it. | 3688 | { |
3692 | m_log.WarnFormat( | 3689 | // We have a zombie from a crashed session. |
3693 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3690 | // Or the same user is trying to be root twice here, won't work. |
3694 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3691 | // Kill it. |
3695 | 3692 | m_log.WarnFormat( | |
3696 | if (sp.ControllingClient != null) | 3693 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", |
3697 | sp.ControllingClient.Close(true); | 3694 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3695 | |||
3696 | if (sp.ControllingClient != null) | ||
3697 | sp.ControllingClient.Close(true); | ||
3698 | 3698 | ||
3699 | sp = null; | 3699 | sp = null; |
3700 | } | ||
3701 | else | ||
3702 | m_log.WarnFormat("[SCENE]: Existing root scene presence for {0} {1} in {2}, but agent is in trasit", sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3700 | } | 3703 | } |
3701 | else | 3704 | else |
3702 | { | 3705 | { |
3706 | // We have a child agent here | ||
3703 | sp.DoNotCloseAfterTeleport = true; | 3707 | sp.DoNotCloseAfterTeleport = true; |
3708 | //m_log.WarnFormat("[SCENE]: Existing child scene presence for {0} {1} in {2}", sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3704 | } | 3709 | } |
3705 | } | 3710 | } |
3706 | 3711 | ||
@@ -3785,9 +3790,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3785 | agent.AgentID, RegionInfo.RegionName); | 3790 | agent.AgentID, RegionInfo.RegionName); |
3786 | 3791 | ||
3787 | sp.AdjustKnownSeeds(); | 3792 | sp.AdjustKnownSeeds(); |
3788 | 3793 | ||
3789 | if (CapsModule != null) | 3794 | if (CapsModule != null) |
3795 | { | ||
3790 | CapsModule.SetAgentCapsSeeds(agent); | 3796 | CapsModule.SetAgentCapsSeeds(agent); |
3797 | CapsModule.CreateCaps(agent.AgentID); | ||
3798 | } | ||
3791 | } | 3799 | } |
3792 | } | 3800 | } |
3793 | 3801 | ||
@@ -5545,17 +5553,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
5545 | { | 5553 | { |
5546 | reason = "You are banned from the region"; | 5554 | reason = "You are banned from the region"; |
5547 | 5555 | ||
5548 | if (EntityTransferModule.IsInTransit(agentID)) | ||
5549 | { | ||
5550 | reason = "Agent is still in transit from this region"; | ||
5551 | |||
5552 | m_log.WarnFormat( | ||
5553 | "[SCENE]: Denying agent {0} entry into {1} since region still has them registered as in transit", | ||
5554 | agentID, RegionInfo.RegionName); | ||
5555 | |||
5556 | return false; | ||
5557 | } | ||
5558 | |||
5559 | if (Permissions.IsGod(agentID)) | 5556 | if (Permissions.IsGod(agentID)) |
5560 | { | 5557 | { |
5561 | reason = String.Empty; | 5558 | reason = String.Empty; |