From b489c85226f50d791c64588a82b73fabe42490a5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 19 Feb 2012 15:37:37 -0800 Subject: Amend to last commit. This should have been committed too. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8639697..daf711c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1219,7 +1219,7 @@ namespace OpenSim.Region.Framework.Scenes { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) - m_agentTransfer.EnableChildAgents(this); + Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); }); IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) -- cgit v1.1 From 1c3ee5d1cedbd3952ef523778f61c3f7d8e67332 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 19 Feb 2012 16:42:01 -0800 Subject: One more tweak related to the previous 2 commits. --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6e4c0b1..8f047ea 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -994,6 +994,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } + // No turning back + agent.IsChildAgent = true; + string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1138,7 +1141,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// This informs all neighbouring regions about agent "avatar". - /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// /// public void EnableChildAgents(ScenePresence sp) -- cgit v1.1 From 99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 20 Feb 2012 10:58:07 -0800 Subject: More improvements on agent position updates: if the target sims fail, blacklist them for 2 min, so that we don't keep doing remote calls that fail. --- .../Framework/Scenes/SceneCommunicationService.cs | 7 ++----- .../Simulation/SimulationServiceConnector.cs | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c04171b..19c9745 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -140,7 +140,6 @@ namespace OpenSim.Region.Framework.Scenes icon.EndInvoke(iar); } - ExpiringCache _failedSims = new ExpiringCache(); public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) { // This assumes that we know what our neighbors are. @@ -158,15 +157,13 @@ namespace OpenSim.Region.Framework.Scenes Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); bool v = true; - if (! simulatorList.Contains(dest.ServerURI) && !_failedSims.TryGetValue(dest.ServerURI, out v)) + if (! simulatorList.Contains(dest.ServerURI)) { // we havent seen this simulator before, add it to the list // and send it an update simulatorList.Add(dest.ServerURI); // Let move this to sync. Mono definitely does not like async networking. - if (!m_scene.SimulationService.UpdateAgent(dest, cAgentData)) - // Also if it fails, get it out of the loop for a bit - _failedSims.Add(dest.ServerURI, true, 120); + m_scene.SimulationService.UpdateAgent(dest, cAgentData); // Leaving this here as a reminder that we tried, and it sucks. //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c45f456..c45e312 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -153,6 +153,7 @@ namespace OpenSim.Services.Connectors.Simulation return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds } + private ExpiringCache _failedSims = new ExpiringCache(); /// /// Send updated position information about an agent in this region to a neighbor /// This operation may be called very frequently if an avatar is moving about in @@ -160,6 +161,10 @@ namespace OpenSim.Services.Connectors.Simulation /// public bool UpdateAgent(GridRegion destination, AgentPosition data) { + bool v = true; + if (_failedSims.TryGetValue(destination.ServerURI, out v)) + return false; + // The basic idea of this code is that the first thread that needs to // send an update for a specific avatar becomes the worker for any subsequent // requests until there are no more outstanding requests. Further, only send the most @@ -183,9 +188,10 @@ namespace OpenSim.Services.Connectors.Simulation // Otherwise update the reference and start processing m_updateAgentQueue[uri] = data; } - + AgentPosition pos = null; - while (true) + bool success = true; + while (success) { lock (m_updateAgentQueue) { @@ -205,11 +211,13 @@ namespace OpenSim.Services.Connectors.Simulation } } - UpdateAgent(destination, (IAgentData)pos, 10000); + success = UpdateAgent(destination, (IAgentData)pos, 10000); } - - // unreachable -// return true; + // we get here iff success == false + // blacklist sim for 2 minutes + _failedSims.AddOrUpdate(destination.ServerURI, true, 120); + m_updateAgentQueue.Clear(); + return false; } /// -- cgit v1.1 From 4a329098e8eba012cbf9f66627443968cbf9d726 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 20 Feb 2012 11:12:02 -0800 Subject: Amend to last commit: synchronize access to queues. --- .../Services/Connectors/Simulation/SimulationServiceConnector.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c45e312..65f01b3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -215,8 +215,11 @@ namespace OpenSim.Services.Connectors.Simulation } // we get here iff success == false // blacklist sim for 2 minutes - _failedSims.AddOrUpdate(destination.ServerURI, true, 120); - m_updateAgentQueue.Clear(); + lock (m_updateAgentQueue) + { + _failedSims.AddOrUpdate(destination.ServerURI, true, 120); + m_updateAgentQueue.Remove(uri); + } return false; } -- cgit v1.1