From e777f88028322c9a7042ba20669b00fd9fbd573c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 15 Apr 2008 23:10:12 +0000 Subject: [PATCH] * A tweak of the caps system so that new caps have random paths instead of a fixed path * This allows caps requests to be routed to regions where the agent is currently a root agent instead of the region that they logged into as it did previously. * This fixes a wide variety of bugs related to 'can't do X once i've crossed a border'. * The first seed cap request fails, the second one works. (this generates an error message on the console) * Experimental. --- .../Communications/Cache/CachedUserInfo.cs | 13 ++++++++++++ OpenSim/Framework/IScene.cs | 3 ++- OpenSim/Region/Environment/Scenes/Scene.cs | 21 +++++++++++++++++-- .../Region/Environment/Scenes/SceneBase.cs | 12 +++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index ec5717ec4a..9f202ffc6d 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -251,6 +251,11 @@ namespace OpenSim.Framework.Communications.Cache ItemReceive(userID, itemInfo); m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); } + else + { + m_log.Error("[UNABLE TO UPLOAD]: "); + } + } /// @@ -264,6 +269,10 @@ namespace OpenSim.Framework.Communications.Cache { m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); } + else + { + m_log.Error("[UNABLE TO UPDATE]: "); + } } /// @@ -283,6 +292,10 @@ namespace OpenSim.Framework.Communications.Cache m_commsManager.InventoryService.DeleteInventoryItem(userID, item); } } + else + { + m_log.Error("[UNABLE TO DELETE]: "); + } return result; } diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index cdf6257b70..ad3bd91586 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -64,6 +64,7 @@ namespace OpenSim.Framework ClientManager ClientManager { get; } - string GetCapsPath(LLUUID agentId); + string GetCapsPath(LLUUID agentId); + string GetNewCapsPath(LLUUID agentId); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ba8a356b81..957c75c47e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1867,8 +1867,25 @@ namespace OpenSim.Region.Environment.Scenes /// /// public void AddCapsHandler(LLUUID agentId) - { - String capsObjectPath = GetCapsPath(agentId); + { + // Here we clear out old Caps handlers for the agent + // this is required because we potentially have multiple simulators in an instance nearby. + Caps oldcap = null; + lock (m_capsHandlers) + { + if (m_capsHandlers.ContainsKey(agentId)) + oldcap = m_capsHandlers[agentId]; + } + if (oldcap != null) + { + oldcap.DeregisterHandlers(); + } + + // Generate a new base caps path LLUUID.Random().ToString() instead of agentId.ToString() + // If the caps paths are not different for each region, the client and sim will do weird + // things like send the request to a region the agent is no longer in. + + String capsObjectPath = GetNewCapsPath(agentId); m_log.DebugFormat( "[CAPS]: Setting up CAPS handler for root agent {0} in {1}", diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 5551173520..f863bffa61 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -214,5 +214,17 @@ namespace OpenSim.Region.Environment.Scenes return null; } + public string GetNewCapsPath(LLUUID agentID) + { + if (capsPaths.ContainsKey(agentID)) + { + capsPaths[agentID] = LLUUID.Random().ToString(); + } + else + { + capsPaths.Add(agentID, LLUUID.Random().ToString()); + } + return GetCapsPath(agentID); + } } }