Better test for dropping inventory cache and writing out debug messages.

arthursv
Diva Canto 2009-08-12 09:31:33 -07:00
parent 613e6f07fc
commit b3b506cba2
1 changed files with 22 additions and 17 deletions

View File

@ -60,20 +60,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
// If not, go get them and place them in the cache // If not, go get them and place them in the cache
Dictionary<AssetType, InventoryFolderBase> folders = GetSystemFolders(presence.UUID); Dictionary<AssetType, InventoryFolderBase> folders = GetSystemFolders(presence.UUID);
m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, fetched system folders for {0} {1}: count {2}", m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
presence.Firstname, presence.Lastname, folders.Count); presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
if (folders.Count > 0) if (folders.Count > 0)
lock (m_InventoryCache) lock (m_InventoryCache)
m_InventoryCache.Add(presence.UUID, folders); m_InventoryCache.Add(presence.UUID, folders);
} }
void OnClientClosed(UUID clientID, Scene scene) void OnClientClosed(UUID clientID, Scene scene)
{
if (m_InventoryCache.ContainsKey(clientID)) // if it's still in cache
{ {
ScenePresence sp = null; ScenePresence sp = null;
foreach (Scene s in m_Scenes) foreach (Scene s in m_Scenes)
{ {
s.TryGetAvatar(clientID, out sp); s.TryGetAvatar(clientID, out sp);
if ((sp != null) && !sp.IsChildAgent) if ((sp != null) && !sp.IsChildAgent && (s != scene))
{ {
m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache",
scene.RegionInfo.RegionName, clientID); scene.RegionInfo.RegionName, clientID);
@ -81,13 +83,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
scene.RegionInfo.RegionName, clientID);
// Drop system folders // Drop system folders
lock (m_InventoryCache) lock (m_InventoryCache)
if (m_InventoryCache.ContainsKey(clientID)) if (m_InventoryCache.ContainsKey(clientID))
m_InventoryCache.Remove(clientID); {
m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
scene.RegionInfo.RegionName, clientID);
m_InventoryCache.Remove(clientID);
}
}
} }
public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);