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.
integration
Justin Clark-Casey (justincc) 2012-10-26 01:15:16 +01:00
parent 85c909c0b5
commit 2fb89b5aac
3 changed files with 106 additions and 103 deletions

View File

@ -38,15 +38,15 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule public class InventoryTransferModule : ISharedRegionModule
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
private List<Scene> m_Scenelist = new List<Scene>(); private List<Scene> m_Scenelist = new List<Scene>();
private Dictionary<UUID, Scene> m_AgentRegions = // private Dictionary<UUID, Scene> m_AgentRegions =
new Dictionary<UUID, Scene>(); // new Dictionary<UUID, Scene>();
private IMessageTransferModule m_TransferModule = null; private IMessageTransferModule m_TransferModule = null;
private bool m_Enabled = true; private bool m_Enabled = true;
@ -76,12 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_Scenelist.Add(scene); m_Scenelist.Add(scene);
scene.RegisterModuleInterface<IInventoryTransferModule>(this); // scene.RegisterModuleInterface<IInventoryTransferModule>(this);
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += ClientLoggedOut; // scene.EventManager.OnClientClosed += ClientLoggedOut;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; // scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -96,9 +96,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_Scenelist.Clear(); m_Scenelist.Clear();
scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnClientClosed -= ClientLoggedOut; // scene.EventManager.OnClientClosed -= ClientLoggedOut;
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 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) public void RemoveRegion(Scene scene)
{ {
scene.EventManager.OnNewClient -= OnNewClient; scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnClientClosed -= ClientLoggedOut; // scene.EventManager.OnClientClosed -= ClientLoggedOut;
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
m_Scenelist.Remove(scene); m_Scenelist.Remove(scene);
} }
@ -138,10 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
client.OnInstantMessage += OnInstantMessage; client.OnInstantMessage += OnInstantMessage;
} }
protected void OnSetRootAgentScene(UUID id, Scene scene) // protected void OnSetRootAgentScene(UUID id, Scene scene)
{ // {
m_AgentRegions[id] = scene; // m_AgentRegions[id] = scene;
} // }
private Scene FindClientScene(UUID agentId) private Scene FindClientScene(UUID agentId)
{ {
@ -448,69 +448,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
} }
} }
public bool NeedSceneCacheClear(UUID agentID, Scene scene) // public bool NeedSceneCacheClear(UUID agentID, Scene scene)
{ // {
if (!m_AgentRegions.ContainsKey(agentID)) // if (!m_AgentRegions.ContainsKey(agentID))
{ // {
// Since we can get here two ways, we need to scan // // Since we can get here two ways, we need to scan
// the scenes here. This is somewhat more expensive // // the scenes here. This is somewhat more expensive
// but helps avoid a nasty bug // // but helps avoid a nasty bug
// // //
//
foreach (Scene s in m_Scenelist) // foreach (Scene s in m_Scenelist)
{ // {
ScenePresence presence; // ScenePresence presence;
//
if (s.TryGetScenePresence(agentID, out presence)) // if (s.TryGetScenePresence(agentID, out presence))
{ // {
// If the agent is in this scene, then we // // If the agent is in this scene, then we
// are being called twice in a single // // are being called twice in a single
// teleport. This is wasteful of cycles // // teleport. This is wasteful of cycles
// but harmless due to this 2nd level check // // but harmless due to this 2nd level check
// // //
// If the agent is found in another scene // // If the agent is found in another scene
// then the list wasn't current // // then the list wasn't current
// // //
// If the agent is totally unknown, then what // // If the agent is totally unknown, then what
// are we even doing here?? // // are we even doing here??
// // //
if (s == scene) // if (s == scene)
{ // {
//m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); // //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName);
return true; // return true;
} // }
else // else
{ // {
//m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); // //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName);
return false; // return false;
} // }
} // }
} // }
//m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); // //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName);
return true; // return true;
} // }
//
// The agent is left in current Scene, so we must be // // The agent is left in current Scene, so we must be
// going to another instance // // going to another instance
// // //
if (m_AgentRegions[agentID] == scene) // if (m_AgentRegions[agentID] == scene)
{ // {
//m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); // //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName);
m_AgentRegions.Remove(agentID); // m_AgentRegions.Remove(agentID);
return true; // return true;
} // }
//
// Another region has claimed the agent // // Another region has claimed the agent
// // //
//m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); // //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName);
return false; // return false;
} // }
//
public void ClientLoggedOut(UUID agentID, Scene scene) // public void ClientLoggedOut(UUID agentID, Scene scene)
{ // {
if (m_AgentRegions.ContainsKey(agentID)) // if (m_AgentRegions.ContainsKey(agentID))
m_AgentRegions.Remove(agentID); // m_AgentRegions.Remove(agentID);
} // }
/// <summary> /// <summary>
/// ///

View File

@ -672,13 +672,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Reset(); sp.Reset();
} }
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! // Commented pending deletion since this method no longer appears to do anything at all
if (sp.Scene.NeedSceneCacheClear(sp.UUID)) // // 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", // m_log.DebugFormat(
sp.UUID); // "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
} // sp.UUID);
// }
m_entityTransferStateMachine.ResetFromTransit(sp.UUID); m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
} }
@ -1237,14 +1238,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
AgentHasMovedAway(agent, false); AgentHasMovedAway(agent, false);
// the user may change their profile information in other region, // // the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it // // so the userinfo in UserProfileCache is not reliable any more, delete it
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! // // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
if (agent.Scene.NeedSceneCacheClear(agent.UUID)) // if (agent.Scene.NeedSceneCacheClear(agent.UUID))
{ // {
m_log.DebugFormat( // m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); // "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
} // }
//m_log.Debug("AFTER CROSS"); //m_log.Debug("AFTER CROSS");
//Scene.DumpChildrenSeeds(UUID); //Scene.DumpChildrenSeeds(UUID);

View File

@ -3435,9 +3435,10 @@ namespace OpenSim.Region.Framework.Scenes
if (closeChildAgents && CapsModule != null) if (closeChildAgents && CapsModule != null)
CapsModule.RemoveCaps(agentID); CapsModule.RemoveCaps(agentID);
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
// this method is doing is HORRIBLE!!! // // this method is doing is HORRIBLE!!!
avatar.Scene.NeedSceneCacheClear(avatar.UUID); // Commented pending deletion since this method no longer appears to do anything at all
// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
if (closeChildAgents && !isChildAgent) if (closeChildAgents && !isChildAgent)
{ {
@ -4873,14 +4874,15 @@ namespace OpenSim.Region.Framework.Scenes
client.SendRegionHandle(regionID, handle); client.SendRegionHandle(regionID, handle);
} }
public bool NeedSceneCacheClear(UUID agentID) // Commented pending deletion since this method no longer appears to do anything at all
{ // public bool NeedSceneCacheClear(UUID agentID)
IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); // {
if (inv == null) // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
return true; // if (inv == null)
// return true;
return inv.NeedSceneCacheClear(agentID, this); //
} // return inv.NeedSceneCacheClear(agentID, this);
// }
public void CleanTempObjects() public void CleanTempObjects()
{ {