Make dictionary read/write locking consistent in CapabilitiesModule, rename two dictionary fields to standard m_ format
parent
2f6ee8aee2
commit
a38c2abae4
|
@ -57,8 +57,8 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
|
protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
|
||||||
|
|
||||||
protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>();
|
protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
|
||||||
protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds
|
protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds
|
||||||
= new Dictionary<UUID, Dictionary<ulong, string>>();
|
= new Dictionary<UUID, Dictionary<ulong, string>>();
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -105,8 +105,11 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
|
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Caps caps;
|
||||||
String capsObjectPath = GetCapsPath(agentId);
|
String capsObjectPath = GetCapsPath(agentId);
|
||||||
|
|
||||||
|
lock (m_capsObjects)
|
||||||
|
{
|
||||||
if (m_capsObjects.ContainsKey(agentId))
|
if (m_capsObjects.ContainsKey(agentId))
|
||||||
{
|
{
|
||||||
Caps oldCaps = m_capsObjects[agentId];
|
Caps oldCaps = m_capsObjects[agentId];
|
||||||
|
@ -120,20 +123,24 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
|
||||||
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
|
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
|
||||||
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
|
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
m_capsObjects[agentId] = caps;
|
m_capsObjects[agentId] = caps;
|
||||||
|
}
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
|
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCaps(UUID agentId)
|
public void RemoveCaps(UUID agentId)
|
||||||
{
|
{
|
||||||
if (childrenSeeds.ContainsKey(agentId))
|
lock (m_childrenSeeds)
|
||||||
{
|
{
|
||||||
childrenSeeds.Remove(agentId);
|
if (m_childrenSeeds.ContainsKey(agentId))
|
||||||
|
{
|
||||||
|
m_childrenSeeds.Remove(agentId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_capsObjects)
|
lock (m_capsObjects)
|
||||||
|
@ -168,16 +175,22 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
|
|
||||||
public void SetAgentCapsSeeds(AgentCircuitData agent)
|
public void SetAgentCapsSeeds(AgentCircuitData agent)
|
||||||
{
|
{
|
||||||
capsPaths[agent.AgentID] = agent.CapsPath;
|
lock (m_capsPaths)
|
||||||
childrenSeeds[agent.AgentID]
|
m_capsPaths[agent.AgentID] = agent.CapsPath;
|
||||||
|
|
||||||
|
lock (m_childrenSeeds)
|
||||||
|
m_childrenSeeds[agent.AgentID]
|
||||||
= ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
|
= ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetCapsPath(UUID agentId)
|
public string GetCapsPath(UUID agentId)
|
||||||
{
|
{
|
||||||
if (capsPaths.ContainsKey(agentId))
|
lock (m_capsPaths)
|
||||||
{
|
{
|
||||||
return capsPaths[agentId];
|
if (m_capsPaths.ContainsKey(agentId))
|
||||||
|
{
|
||||||
|
return m_capsPaths[agentId];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -186,42 +199,59 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
|
public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
|
||||||
{
|
{
|
||||||
Dictionary<ulong, string> seeds = null;
|
Dictionary<ulong, string> seeds = null;
|
||||||
if (childrenSeeds.TryGetValue(agentID, out seeds))
|
|
||||||
|
lock (m_childrenSeeds)
|
||||||
|
if (m_childrenSeeds.TryGetValue(agentID, out seeds))
|
||||||
return seeds;
|
return seeds;
|
||||||
|
|
||||||
return new Dictionary<ulong, string>();
|
return new Dictionary<ulong, string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DropChildSeed(UUID agentID, ulong handle)
|
public void DropChildSeed(UUID agentID, ulong handle)
|
||||||
{
|
{
|
||||||
Dictionary<ulong, string> seeds;
|
Dictionary<ulong, string> seeds;
|
||||||
if (childrenSeeds.TryGetValue(agentID, out seeds))
|
|
||||||
|
lock (m_childrenSeeds)
|
||||||
|
{
|
||||||
|
if (m_childrenSeeds.TryGetValue(agentID, out seeds))
|
||||||
{
|
{
|
||||||
seeds.Remove(handle);
|
seeds.Remove(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GetChildSeed(UUID agentID, ulong handle)
|
public string GetChildSeed(UUID agentID, ulong handle)
|
||||||
{
|
{
|
||||||
Dictionary<ulong, string> seeds;
|
Dictionary<ulong, string> seeds;
|
||||||
string returnval;
|
string returnval;
|
||||||
if (childrenSeeds.TryGetValue(agentID, out seeds))
|
|
||||||
|
lock (m_childrenSeeds)
|
||||||
|
{
|
||||||
|
if (m_childrenSeeds.TryGetValue(agentID, out seeds))
|
||||||
{
|
{
|
||||||
if (seeds.TryGetValue(handle, out returnval))
|
if (seeds.TryGetValue(handle, out returnval))
|
||||||
return returnval;
|
return returnval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
|
public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
|
//m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
|
||||||
childrenSeeds[agentID] = seeds;
|
|
||||||
|
lock (m_childrenSeeds)
|
||||||
|
m_childrenSeeds[agentID] = seeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DumpChildrenSeeds(UUID agentID)
|
public void DumpChildrenSeeds(UUID agentID)
|
||||||
{
|
{
|
||||||
m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================");
|
m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================");
|
||||||
foreach (KeyValuePair<ulong, string> kvp in childrenSeeds[agentID])
|
|
||||||
|
lock (m_childrenSeeds)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
|
||||||
{
|
{
|
||||||
uint x, y;
|
uint x, y;
|
||||||
Utils.LongToUInts(kvp.Key, out x, out y);
|
Utils.LongToUInts(kvp.Key, out x, out y);
|
||||||
|
@ -230,12 +260,15 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
|
m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleShowCapsCommand(string module, string[] cmdparams)
|
private void HandleShowCapsCommand(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
StringBuilder caps = new StringBuilder();
|
StringBuilder caps = new StringBuilder();
|
||||||
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
|
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
lock (m_capsObjects)
|
||||||
|
{
|
||||||
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
|
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
|
||||||
{
|
{
|
||||||
caps.AppendFormat("** User {0}:\n", kvp.Key);
|
caps.AppendFormat("** User {0}:\n", kvp.Key);
|
||||||
|
@ -249,6 +282,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
|
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
|
||||||
caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
|
caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainConsole.Instance.Output(caps.ToString());
|
MainConsole.Instance.Output(caps.ToString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue