mirror of
https://github.com/opensim/opensim.git
synced 2026-08-13 05:05:43 +08:00
bad merge?
This commit is contained in:
@@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
/// <summary>
|
||||
/// Each agent has its own capabilities handler.
|
||||
/// </summary>
|
||||
protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
|
||||
protected Dictionary<uint, Caps> m_capsObjects = new Dictionary<uint, Caps>();
|
||||
|
||||
protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
|
||||
|
||||
@@ -118,23 +118,46 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void CreateCaps(UUID agentId)
|
||||
public void CreateCaps(UUID agentId, uint circuitCode)
|
||||
{
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
|
||||
return;
|
||||
int ts = Util.EnvironmentTickCount();
|
||||
/* this as no business here...
|
||||
* must be done elsewhere ( and is )
|
||||
int flags = m_scene.GetUserFlags(agentId);
|
||||
|
||||
m_log.ErrorFormat("[CreateCaps]: banCheck {0} ", Util.EnvironmentTickCountSubtract(ts));
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
|
||||
return;
|
||||
*/
|
||||
Caps caps;
|
||||
String capsObjectPath = GetCapsPath(agentId);
|
||||
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
if (m_capsObjects.ContainsKey(agentId))
|
||||
if (m_capsObjects.ContainsKey(circuitCode))
|
||||
{
|
||||
Caps oldCaps = m_capsObjects[agentId];
|
||||
|
||||
//m_log.WarnFormat(
|
||||
// "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
|
||||
// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
|
||||
Caps oldCaps = m_capsObjects[circuitCode];
|
||||
|
||||
|
||||
if (capsObjectPath == oldCaps.CapsObjectPath)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
|
||||
agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not reusing add extra melanie cleanup
|
||||
// Remove tge handlers. They may conflict with the
|
||||
// new object created below
|
||||
oldCaps.DeregisterHandlers();
|
||||
|
||||
// Better safe ... should not be needed but also
|
||||
// no big deal
|
||||
m_capsObjects.Remove(circuitCode);
|
||||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
@@ -145,13 +168,17 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
|
||||
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
|
||||
|
||||
m_capsObjects[agentId] = caps;
|
||||
}
|
||||
m_log.ErrorFormat("[CreateCaps]: new caps agent {0}, circuit {1}, path {2}, time {3} ",agentId,
|
||||
circuitCode,caps.CapsObjectPath, Util.EnvironmentTickCountSubtract(ts));
|
||||
|
||||
m_capsObjects[circuitCode] = caps;
|
||||
}
|
||||
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
|
||||
// m_log.ErrorFormat("[CreateCaps]: end {0} ", Util.EnvironmentTickCountSubtract(ts));
|
||||
|
||||
}
|
||||
|
||||
public void RemoveCaps(UUID agentId)
|
||||
public void RemoveCaps(UUID agentId, uint circuitCode)
|
||||
{
|
||||
m_log.DebugFormat("[CAPS]: Remove caps for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName);
|
||||
lock (m_childrenSeeds)
|
||||
@@ -164,14 +191,24 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
if (m_capsObjects.ContainsKey(agentId))
|
||||
if (m_capsObjects.ContainsKey(circuitCode))
|
||||
{
|
||||
m_capsObjects[agentId].DeregisterHandlers();
|
||||
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]);
|
||||
m_capsObjects.Remove(agentId);
|
||||
m_capsObjects[circuitCode].DeregisterHandlers();
|
||||
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[circuitCode]);
|
||||
m_capsObjects.Remove(circuitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
|
||||
{
|
||||
if (kvp.Value.AgentID == agentId)
|
||||
{
|
||||
kvp.Value.DeregisterHandlers();
|
||||
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, kvp.Value);
|
||||
m_capsObjects.Remove(kvp.Key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_log.WarnFormat(
|
||||
"[CAPS]: Received request to remove CAPS handler for root agent {0} in {1}, but no such CAPS handler found!",
|
||||
agentId, m_scene.RegionInfo.RegionName);
|
||||
@@ -179,19 +216,30 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public Caps GetCapsForUser(UUID agentId)
|
||||
public Caps GetCapsForUser(uint circuitCode)
|
||||
{
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
if (m_capsObjects.ContainsKey(agentId))
|
||||
if (m_capsObjects.ContainsKey(circuitCode))
|
||||
{
|
||||
return m_capsObjects[agentId];
|
||||
return m_capsObjects[circuitCode];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ActivateCaps(uint circuitCode)
|
||||
{
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
if (m_capsObjects.ContainsKey(circuitCode))
|
||||
{
|
||||
m_capsObjects[circuitCode].Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAgentCapsSeeds(AgentCircuitData agent)
|
||||
{
|
||||
lock (m_capsPaths)
|
||||
@@ -289,9 +337,9 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
|
||||
lock (m_capsObjects)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
|
||||
foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
|
||||
{
|
||||
capsReport.AppendFormat("** User {0}:\n", kvp.Key);
|
||||
capsReport.AppendFormat("** Circuit {0}:\n", kvp.Key);
|
||||
Caps caps = kvp.Value;
|
||||
|
||||
for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); )
|
||||
@@ -339,6 +387,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
|
||||
private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
|
||||
{
|
||||
/*
|
||||
sb.AppendFormat("Capability name {0}\n", capName);
|
||||
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||
@@ -384,10 +433,12 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
}
|
||||
|
||||
sb.Append(cdt.ToString());
|
||||
*/
|
||||
}
|
||||
|
||||
private void BuildSummaryStatsByCapReport(StringBuilder sb)
|
||||
{
|
||||
/*
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||
cdt.AddColumn("Name", 34);
|
||||
cdt.AddColumn("Req Received", 12);
|
||||
@@ -444,10 +495,12 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
|
||||
|
||||
sb.Append(cdt.ToString());
|
||||
*/
|
||||
}
|
||||
|
||||
private void HandleShowCapsStatsByUserCommand(string module, string[] cmdParams)
|
||||
{
|
||||
/*
|
||||
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
|
||||
return;
|
||||
|
||||
@@ -478,10 +531,12 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(sb.ToString());
|
||||
*/
|
||||
}
|
||||
|
||||
private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
|
||||
{
|
||||
/*
|
||||
sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");
|
||||
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||
@@ -507,10 +562,12 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled);
|
||||
|
||||
sb.Append(cdt.ToString());
|
||||
*/
|
||||
}
|
||||
|
||||
private void BuildSummaryStatsByUserReport(StringBuilder sb)
|
||||
{
|
||||
/*
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||
cdt.AddColumn("Name", 32);
|
||||
cdt.AddColumn("Type", 5);
|
||||
@@ -550,6 +607,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
);
|
||||
|
||||
sb.Append(cdt.ToString());
|
||||
*/
|
||||
}
|
||||
|
||||
private class CapTableRow
|
||||
@@ -566,4 +624,4 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user