Added a cache to message transfer module for UUID->GridRegion data
parent
0319807820
commit
71d991fe8a
|
@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
|
protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
|
||||||
|
protected Dictionary<UUID, GridRegion> m_RegionInfoMap = new Dictionary<UUID, GridRegion>();
|
||||||
|
|
||||||
public event UndeliveredMessage OnUndeliveredMessage;
|
public event UndeliveredMessage OnUndeliveredMessage;
|
||||||
|
|
||||||
|
@ -536,8 +537,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
|
|
||||||
if (upd != null)
|
if (upd != null)
|
||||||
{
|
{
|
||||||
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
|
GridRegion reginfo = null;
|
||||||
upd.RegionID);
|
// Try to pull reginfo from our cache
|
||||||
|
lock (m_RegionInfoMap)
|
||||||
|
{
|
||||||
|
if (!m_RegionInfoMap.TryGetValue(upd.RegionID, out reginfo))
|
||||||
|
reginfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it wasn't there, then look it up from grid.
|
||||||
|
if (reginfo == null)
|
||||||
|
{
|
||||||
|
reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, upd.RegionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found the reginfo, send the IM to the region
|
||||||
if (reginfo != null)
|
if (reginfo != null)
|
||||||
{
|
{
|
||||||
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
|
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
|
||||||
|
@ -560,6 +574,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
m_UserRegionMap.Add(toAgentID, upd.RegionID);
|
m_UserRegionMap.Add(toAgentID, upd.RegionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lock (m_RegionInfoMap)
|
||||||
|
{
|
||||||
|
// Since we never look it up again, we don't need to update it
|
||||||
|
// but if it's not in the map yet, add it now.
|
||||||
|
if (!m_RegionInfoMap.ContainsKey(upd.RegionID))
|
||||||
|
m_RegionInfoMap.Add(upd.RegionID, reginfo);
|
||||||
|
}
|
||||||
result(true);
|
result(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue