From f14c102c7a9aa0a5577ec9ec5ca76adc1a8f10f7 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 24 Mar 2008 21:21:05 +0000 Subject: [PATCH] * Clean up Scene.AddCapsHandler(). There was a race condition warning, but I don't think this is now relevant... * Remove some now extraneous CAPS related messages --- OpenSim/Region/Environment/Scenes/Scene.cs | 46 ++++--------------- .../Environment/Scenes/ScenePresence.cs | 8 ++++ 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 9c0b33c9ca..2e6b67ea25 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1681,12 +1681,6 @@ namespace OpenSim.Region.Environment.Scenes { AddCapsHandler(agent.AgentID); } - else - { - m_log.WarnFormat( - "[CONNECTION DEBUGGING]: Skipped setting up CAPS handler for avatar {0} at {1}", - agent.AgentID, RegionInfo.RegionName); - } m_log.DebugFormat( "[CONNECTION DEBUGGING]: Creating new circuit code ({0}) for avatar {1} at {2}", @@ -1703,18 +1697,19 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// Add a caps handler for the given agent. + /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent, + /// then it is replaced by a new CAPS handler. /// /// - /// + /// public void AddCapsHandler(LLUUID agentId) - { - String capsObjectPath = GetCapsPath(agentId); - + { + String capsObjectPath = GetCapsPath(agentId); + m_log.DebugFormat( "[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} at {1} in {2}", agentId, capsObjectPath, RegionInfo.RegionName); - + Caps cap = new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port, capsObjectPath, agentId, m_dumpAssetsToFile); @@ -1726,31 +1721,8 @@ namespace OpenSim.Region.Environment.Scenes cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS; - if (m_capsHandlers.ContainsKey(agentId)) - { - m_log.DebugFormat( - "[CONNECTION DEBUGGING]: Caps path already in use for avatar {0} in region {1}", - agentId, RegionInfo.RegionName); - - try - { - m_capsHandlers[agentId] = cap; - } - catch (KeyNotFoundException) - { - m_log.DebugFormat( - "[CONNECTION DEBUGGING]: Caught exception adding handler for avatar {0} at {1}", - agentId, RegionInfo.RegionName); - - // Fix for a potential race condition. - m_capsHandlers.Add(agentId, cap); - } - } - else - { - m_capsHandlers.Add(agentId, cap); - } - } + m_capsHandlers[agentId] = cap; + } /// /// diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index def7a77cdc..df43490802 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -536,6 +536,10 @@ namespace OpenSim.Region.Environment.Scenes /// public void MakeRootAgent(LLVector3 pos, bool isFlying) { +// m_log.DebugFormat( +// "[SCENEPRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2}", +// Name, UUID, m_scene.RegionInfo.RegionName); + m_isChildAgent = false; AbsolutePosition = pos; @@ -564,6 +568,10 @@ namespace OpenSim.Region.Environment.Scenes /// public void MakeChildAgent() { +// m_log.DebugFormat( +// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", +// Name, UUID, m_scene.RegionInfo.RegionName); + Velocity = new LLVector3(0, 0, 0); m_isChildAgent = true; m_scene.SwapRootAgentCount(true);