backport xmlrpcgroups cache from master
parent
0524458069
commit
8b3b89ecf4
|
@ -3517,8 +3517,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// if (text.IndexOf("\n") >= 0)
|
// if (text.IndexOf("\n") >= 0)
|
||||||
// text = text.Remove(text.IndexOf("\n"));
|
// text = text.Remove(text.IndexOf("\n"));
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}",
|
// "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}",
|
||||||
// data.localID, text, Name);
|
// data.localID, data.attachment, text, Name);
|
||||||
|
|
||||||
if (data.priority == double.NaN)
|
if (data.priority == double.NaN)
|
||||||
{
|
{
|
||||||
|
|
|
@ -411,18 +411,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
// with the powers requested (powers = 0 for no powers check)
|
// with the powers requested (powers = 0 for no powers check)
|
||||||
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
|
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
|
||||||
{
|
{
|
||||||
if (null == m_groupsModule)
|
//DateTime t1 = DateTime.Now;
|
||||||
return false;
|
bool result = false;
|
||||||
|
|
||||||
GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
|
if (null != m_groupsModule)
|
||||||
|
|
||||||
if (gmd != null)
|
|
||||||
{
|
{
|
||||||
if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
|
GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
|
||||||
return true;
|
|
||||||
|
if (gmd != null)
|
||||||
|
{
|
||||||
|
if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[PERMISSIONS]: Group member check took {0}", (DateTime.Now - t1).TotalMilliseconds);
|
||||||
|
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
|
public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[SCENE]: {0} requested full update for {1}", remoteClient.Name, primLocalID);
|
||||||
|
|
||||||
List<EntityBase> EntityList = GetEntities();
|
List<EntityBase> EntityList = GetEntities();
|
||||||
|
|
||||||
foreach (EntityBase ent in EntityList)
|
foreach (EntityBase ent in EntityList)
|
||||||
|
@ -124,7 +126,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (((SceneObjectGroup)ent).LocalId == primLocalID)
|
if (((SceneObjectGroup)ent).LocalId == primLocalID)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SCENE]: Received full update request for {0} from {1}", primLocalID, remoteClient.Name);
|
|
||||||
((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
|
((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1519,7 +1519,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// if (IsAttachment)
|
// if (IsAttachment)
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
|
// "[SOG]: Sending part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
|
||||||
|
|
||||||
if (m_rootPart.UUID == part.UUID)
|
if (m_rootPart.UUID == part.UUID)
|
||||||
{
|
{
|
||||||
|
@ -2033,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void ScheduleGroupForFullUpdate()
|
public void ScheduleGroupForFullUpdate()
|
||||||
{
|
{
|
||||||
// if (IsAttachment)
|
// if (IsAttachment)
|
||||||
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, UUID);
|
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
|
||||||
|
|
||||||
checkAtTargets();
|
checkAtTargets();
|
||||||
RootPart.ScheduleFullUpdate();
|
RootPart.ScheduleFullUpdate();
|
||||||
|
@ -2072,7 +2072,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (IsDeleted)
|
if (IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID);
|
// m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, LocalId);
|
||||||
|
|
||||||
RootPart.SendFullUpdateToAllClients();
|
RootPart.SendFullUpdateToAllClients();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
|
@ -72,7 +74,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private bool m_debugEnabled = false;
|
private bool m_debugEnabled = false;
|
||||||
|
|
||||||
|
private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
|
||||||
|
private int m_cacheTimeout = 30;
|
||||||
|
|
||||||
// Used to track which agents are have dropped from a group chat session
|
// Used to track which agents are have dropped from a group chat session
|
||||||
// Should be reset per agent, on logon
|
// Should be reset per agent, on logon
|
||||||
// TODO: move this to Flotsam XmlRpc Service
|
// TODO: move this to Flotsam XmlRpc Service
|
||||||
|
@ -132,8 +136,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
||||||
|
|
||||||
|
m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
|
||||||
|
if (m_cacheTimeout == 0)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
// If we got all the config options we need, lets start'er'up
|
// If we got all the config options we need, lets start'er'up
|
||||||
|
m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
|
||||||
m_connectorEnabled = true;
|
m_connectorEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -921,61 +935,94 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
|
private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
|
||||||
{
|
{
|
||||||
string UserService;
|
|
||||||
UUID SessionID;
|
|
||||||
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
|
|
||||||
param.Add("RequestingAgentID", requestingAgentID.ToString());
|
|
||||||
param.Add("RequestingAgentUserService", UserService);
|
|
||||||
param.Add("RequestingSessionID", SessionID.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
param.Add("ReadKey", m_groupReadKey);
|
|
||||||
param.Add("WriteKey", m_groupWriteKey);
|
|
||||||
|
|
||||||
if (m_debugEnabled)
|
|
||||||
{
|
|
||||||
m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:");
|
|
||||||
foreach (string key in param.Keys)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IList parameters = new ArrayList();
|
|
||||||
parameters.Add(param);
|
|
||||||
|
|
||||||
ConfigurableKeepAliveXmlRpcRequest req;
|
|
||||||
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
|
|
||||||
|
|
||||||
XmlRpcResponse resp = null;
|
XmlRpcResponse resp = null;
|
||||||
|
string CacheKey = null;
|
||||||
|
|
||||||
try
|
// Only bother with the cache if it isn't disabled.
|
||||||
|
if (m_cacheTimeout > 0)
|
||||||
{
|
{
|
||||||
resp = req.Send(m_groupsServerURI, 10000);
|
if (!function.StartsWith("groups.get"))
|
||||||
|
{
|
||||||
|
// Any and all updates cause the cache to clear
|
||||||
|
m_memoryCache.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder(requestingAgentID + function);
|
||||||
|
foreach (object key in param.Keys)
|
||||||
|
{
|
||||||
|
if (param[key] != null)
|
||||||
|
{
|
||||||
|
sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheKey = sb.ToString();
|
||||||
|
m_memoryCache.TryGetValue(CacheKey, out resp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
|
if (resp == null)
|
||||||
{
|
{
|
||||||
|
string UserService;
|
||||||
|
UUID SessionID;
|
||||||
|
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
|
||||||
|
param.Add("RequestingAgentID", requestingAgentID.ToString());
|
||||||
|
param.Add("RequestingAgentUserService", UserService);
|
||||||
|
param.Add("RequestingSessionID", SessionID.ToString());
|
||||||
|
|
||||||
|
|
||||||
m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
|
param.Add("ReadKey", m_groupReadKey);
|
||||||
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
|
param.Add("WriteKey", m_groupWriteKey);
|
||||||
|
|
||||||
if ((req != null) && (req.RequestResponse != null))
|
if (m_debugEnabled)
|
||||||
{
|
{
|
||||||
foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
|
m_log.Debug("[XMLRPCGROUPDATA] XmlRpcCall Params:");
|
||||||
|
foreach (string key in param.Keys)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[XMLRPCGROUPDATA] {0} : {1}", key, param[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IList parameters = new ArrayList();
|
||||||
|
parameters.Add(param);
|
||||||
|
|
||||||
|
ConfigurableKeepAliveXmlRpcRequest req;
|
||||||
|
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
|
resp = req.Send(m_groupsServerURI, 10000);
|
||||||
|
|
||||||
|
if ((m_cacheTimeout > 0) && (CacheKey != null))
|
||||||
|
{
|
||||||
|
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
|
|
||||||
foreach (string key in param.Keys)
|
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
|
|
||||||
|
|
||||||
|
m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
|
||||||
|
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
|
||||||
|
|
||||||
|
if ((req != null) && (req.RequestResponse != null))
|
||||||
|
{
|
||||||
|
foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string key in param.Keys)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Hashtable respData = new Hashtable();
|
||||||
|
respData.Add("error", e.ToString());
|
||||||
|
return respData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashtable respData = new Hashtable();
|
|
||||||
respData.Add("error", e.ToString());
|
|
||||||
return respData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue