From 2fb89b5aac0369e126234a8189d676d904d0ae33 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Oct 2012 01:15:16 +0100 Subject: Comment out InventoryTransferModule.NeedSceneCacheClear() and invocations since the call itself does nothing and the return value is ignored by all callers. This is a very old method (+4 years) so is probably confusing code cruft. --- .../Inventory/Transfer/InventoryTransferModule.cs | 154 ++++++++++----------- .../EntityTransfer/EntityTransferModule.cs | 31 +++-- OpenSim/Region/Framework/Scenes/Scene.cs | 24 ++-- 3 files changed, 106 insertions(+), 103 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 33b4839..8ff20dd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -38,15 +38,15 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { - public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule + public class InventoryTransferModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// private List m_Scenelist = new List(); - private Dictionary m_AgentRegions = - new Dictionary(); +// private Dictionary m_AgentRegions = +// new Dictionary(); private IMessageTransferModule m_TransferModule = null; private bool m_Enabled = true; @@ -76,12 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer m_Scenelist.Add(scene); - scene.RegisterModuleInterface(this); +// scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnClientClosed += ClientLoggedOut; +// scene.EventManager.OnClientClosed += ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; - scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; +// scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; } public void RegionLoaded(Scene scene) @@ -96,9 +96,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer m_Scenelist.Clear(); scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= ClientLoggedOut; +// scene.EventManager.OnClientClosed -= ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; +// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; } } } @@ -106,9 +106,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer public void RemoveRegion(Scene scene) { scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= ClientLoggedOut; +// scene.EventManager.OnClientClosed -= ClientLoggedOut; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; +// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; m_Scenelist.Remove(scene); } @@ -138,10 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer client.OnInstantMessage += OnInstantMessage; } - protected void OnSetRootAgentScene(UUID id, Scene scene) - { - m_AgentRegions[id] = scene; - } +// protected void OnSetRootAgentScene(UUID id, Scene scene) +// { +// m_AgentRegions[id] = scene; +// } private Scene FindClientScene(UUID agentId) { @@ -448,69 +448,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } } - public bool NeedSceneCacheClear(UUID agentID, Scene scene) - { - if (!m_AgentRegions.ContainsKey(agentID)) - { - // Since we can get here two ways, we need to scan - // the scenes here. This is somewhat more expensive - // but helps avoid a nasty bug - // - - foreach (Scene s in m_Scenelist) - { - ScenePresence presence; - - if (s.TryGetScenePresence(agentID, out presence)) - { - // If the agent is in this scene, then we - // are being called twice in a single - // teleport. This is wasteful of cycles - // but harmless due to this 2nd level check - // - // If the agent is found in another scene - // then the list wasn't current - // - // If the agent is totally unknown, then what - // are we even doing here?? - // - if (s == scene) - { - //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); - return true; - } - else - { - //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); - return false; - } - } - } - //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); - return true; - } - - // The agent is left in current Scene, so we must be - // going to another instance - // - if (m_AgentRegions[agentID] == scene) - { - //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); - m_AgentRegions.Remove(agentID); - return true; - } - - // Another region has claimed the agent - // - //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); - return false; - } - - public void ClientLoggedOut(UUID agentID, Scene scene) - { - if (m_AgentRegions.ContainsKey(agentID)) - m_AgentRegions.Remove(agentID); - } +// public bool NeedSceneCacheClear(UUID agentID, Scene scene) +// { +// if (!m_AgentRegions.ContainsKey(agentID)) +// { +// // Since we can get here two ways, we need to scan +// // the scenes here. This is somewhat more expensive +// // but helps avoid a nasty bug +// // +// +// foreach (Scene s in m_Scenelist) +// { +// ScenePresence presence; +// +// if (s.TryGetScenePresence(agentID, out presence)) +// { +// // If the agent is in this scene, then we +// // are being called twice in a single +// // teleport. This is wasteful of cycles +// // but harmless due to this 2nd level check +// // +// // If the agent is found in another scene +// // then the list wasn't current +// // +// // If the agent is totally unknown, then what +// // are we even doing here?? +// // +// if (s == scene) +// { +// //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); +// return true; +// } +// else +// { +// //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); +// return false; +// } +// } +// } +// //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); +// return true; +// } +// +// // The agent is left in current Scene, so we must be +// // going to another instance +// // +// if (m_AgentRegions[agentID] == scene) +// { +// //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); +// m_AgentRegions.Remove(agentID); +// return true; +// } +// +// // Another region has claimed the agent +// // +// //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); +// return false; +// } +// +// public void ClientLoggedOut(UUID agentID, Scene scene) +// { +// if (m_AgentRegions.ContainsKey(agentID)) +// m_AgentRegions.Remove(agentID); +// } /// /// diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 90fe430..7498cfe 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -672,13 +672,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Reset(); } - // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! - if (sp.Scene.NeedSceneCacheClear(sp.UUID)) - { - m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", - sp.UUID); - } + // Commented pending deletion since this method no longer appears to do anything at all +// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! +// if (sp.Scene.NeedSceneCacheClear(sp.UUID)) +// { +// m_log.DebugFormat( +// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", +// sp.UUID); +// } m_entityTransferStateMachine.ResetFromTransit(sp.UUID); } @@ -1237,14 +1238,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentHasMovedAway(agent, false); - // the user may change their profile information in other region, - // so the userinfo in UserProfileCache is not reliable any more, delete it - // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! - if (agent.Scene.NeedSceneCacheClear(agent.UUID)) - { - m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); - } +// // the user may change their profile information in other region, +// // so the userinfo in UserProfileCache is not reliable any more, delete it +// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! +// if (agent.Scene.NeedSceneCacheClear(agent.UUID)) +// { +// m_log.DebugFormat( +// "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); +// } //m_log.Debug("AFTER CROSS"); //Scene.DumpChildrenSeeds(UUID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0f39671..9c61fe7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3435,9 +3435,10 @@ namespace OpenSim.Region.Framework.Scenes if (closeChildAgents && CapsModule != null) CapsModule.RemoveCaps(agentID); - // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever - // this method is doing is HORRIBLE!!! - avatar.Scene.NeedSceneCacheClear(avatar.UUID); +// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever +// // this method is doing is HORRIBLE!!! + // Commented pending deletion since this method no longer appears to do anything at all +// avatar.Scene.NeedSceneCacheClear(avatar.UUID); if (closeChildAgents && !isChildAgent) { @@ -4873,14 +4874,15 @@ namespace OpenSim.Region.Framework.Scenes client.SendRegionHandle(regionID, handle); } - public bool NeedSceneCacheClear(UUID agentID) - { - IInventoryTransferModule inv = RequestModuleInterface(); - if (inv == null) - return true; - - return inv.NeedSceneCacheClear(agentID, this); - } +// Commented pending deletion since this method no longer appears to do anything at all +// public bool NeedSceneCacheClear(UUID agentID) +// { +// IInventoryTransferModule inv = RequestModuleInterface(); +// if (inv == null) +// return true; +// +// return inv.NeedSceneCacheClear(agentID, this); +// } public void CleanTempObjects() { -- cgit v1.1