* Change the currently misleading log message when capabilities are added twice, and provide some more information

* No functional change
* It strikes me that there may be caps problems if double registration is presented if cleanup failed for a previous agent (so a caps handler will remain in memory for that 
agent but with a different seed).  This needs investigation
0.6.3-post-fixes
Justin Clarke Casey 2009-01-22 17:51:47 +00:00
parent 20359e8591
commit 8a24f61acd
2 changed files with 17 additions and 16 deletions

View File

@ -73,32 +73,33 @@ namespace OpenSim.Region.Environment.Modules.Agent.Capabilities
String capsObjectPath = GetCapsPath(agentId); String capsObjectPath = GetCapsPath(agentId);
Caps cap = null; if (m_capsHandlers.ContainsKey(agentId))
if (m_capsHandlers.TryGetValue(agentId, out cap))
{ {
Caps oldCaps = m_capsHandlers[agentId];
m_log.DebugFormat( m_log.DebugFormat(
"[CAPS]: Attempt at registering twice for the same agent {0}. {1}. Ignoring.", "[CAPS]: Reregistering caps for agent {0}. Old caps path {1}, new caps path {2}",
agentId, capsObjectPath); agentId, oldCaps.CapsObjectPath, capsObjectPath);
//return; //return;
} }
cap Caps caps
= new Caps( = new Caps(
m_scene.AssetCache, m_scene.CommsManager.HttpServer, m_scene.RegionInfo.ExternalHostName, m_scene.AssetCache, m_scene.CommsManager.HttpServer, m_scene.RegionInfo.ExternalHostName,
m_scene.CommsManager.HttpServer.Port, m_scene.CommsManager.HttpServer.Port,
capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
cap.RegisterHandlers(); caps.RegisterHandlers();
m_scene.EventManager.TriggerOnRegisterCaps(agentId, cap); m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
cap.AddNewInventoryItem = m_scene.AddUploadedInventoryItem; caps.AddNewInventoryItem = m_scene.AddUploadedInventoryItem;
cap.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset; caps.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset;
cap.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset;
cap.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS;
cap.GetClient = m_scene.m_sceneGraph.GetControllingClient; caps.GetClient = m_scene.m_sceneGraph.GetControllingClient;
m_capsHandlers[agentId] = cap; m_capsHandlers[agentId] = caps;
} }
public void RemoveCapsHandler(UUID agentId) public void RemoveCapsHandler(UUID agentId)
@ -114,7 +115,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.Capabilities
{ {
m_capsHandlers[agentId].DeregisterHandlers(); m_capsHandlers[agentId].DeregisterHandlers();
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]); m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]);
m_capsHandlers.Remove(agentId); m_capsHandlers.Remove(agentId);
} }
else else
@ -142,7 +142,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.Capabilities
public void NewUserConnection(AgentCircuitData agent) public void NewUserConnection(AgentCircuitData agent)
{ {
capsPaths[agent.AgentID] = agent.CapsPath; capsPaths[agent.AgentID] = agent.CapsPath;
childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds); childrenSeeds[agent.AgentID]
= ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
} }
public string GetCapsPath(UUID agentId) public string GetCapsPath(UUID agentId)

View File

@ -149,11 +149,11 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (destRegionUp) if (destRegionUp)
{ {
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
// both regions // both regions
if (avatar.ParentID != (uint)0) if (avatar.ParentID != (uint)0)
avatar.StandUp(); avatar.StandUp();
if (!avatar.ValidateAttachments()) if (!avatar.ValidateAttachments())
{ {
avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state");