From e777f88028322c9a7042ba20669b00fd9fbd573c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 15 Apr 2008 23:10:12 +0000 Subject: * 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. --- OpenSim/Region/Environment/Scenes/Scene.cs | 21 +++++++++++++++++++-- OpenSim/Region/Environment/Scenes/SceneBase.cs | 12 ++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ba8a356..957c75c 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 5551173..f863bff 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); + } } } -- cgit v1.1