From e2ab576572a3ca7ab1f29fc142624ae257f5289d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 12 Nov 2008 18:12:18 +0000 Subject: [PATCH] * Stop locking the scene presences dictionary for the entire agent crossing part of the login sequence * This may alleviate a little the freezing experienced by existing avatars when a new client logs in * Race condition risks look minimal since one wouldn't expect another thread to start fiddling with that presence --- .../ClientStack/LindenUDP/LLClientView.cs | 2 -- OpenSim/Region/Environment/Scenes/Scene.cs | 32 ++++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f25f3eb06e..7eb6ef4cc6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -740,8 +740,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); - // Establish our two timers. We could probably get this down to one - // Ping the client regularly to check that it's still there m_clientPingTimer = new Timer(5000); m_clientPingTimer.Elapsed += CheckClientConnectivity; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 326380b557..ceadf7a51a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2863,7 +2863,7 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// + /// Triggered when an agent crosses into this sim. Also happens on initial login. /// /// /// @@ -2873,21 +2873,29 @@ namespace OpenSim.Region.Environment.Scenes { if (regionHandle == m_regInfo.RegionHandle) { + ScenePresence presence; + lock (m_scenePresences) { - if (m_scenePresences.ContainsKey(agentID)) + m_scenePresences.TryGetValue(agentID, out presence); + } + + if (presence != null) + { + try { - try - { - m_scenePresences[agentID].MakeRootAgent(position, isFlying); - } - catch (Exception e) - { - m_log.Info("[SCENE]: Unable to do Agent Crossing."); - m_log.Debug("[SCENE]: " + e.ToString()); - } - //m_innerScene.SwapRootChildAgent(false); + presence.MakeRootAgent(position, isFlying); } + catch (Exception e) + { + m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}", e); + } + } + else + { + m_log.ErrorFormat( + "[SCENE]: Could not find presence for agent {0} crossing into scene {1}", + agentID, RegionInfo.RegionName); } } }