backport xmlrpcgroups cache from master
parent
0524458069
commit
8b3b89ecf4
|
@ -3517,8 +3517,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// if (text.IndexOf("\n") >= 0)
|
||||
// text = text.Remove(text.IndexOf("\n"));
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}",
|
||||
// data.localID, text, Name);
|
||||
// "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}",
|
||||
// data.localID, data.attachment, text, Name);
|
||||
|
||||
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)
|
||||
protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
|
||||
{
|
||||
if (null == m_groupsModule)
|
||||
return false;
|
||||
//DateTime t1 = DateTime.Now;
|
||||
bool result = false;
|
||||
|
||||
if (null != m_groupsModule)
|
||||
{
|
||||
GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
|
||||
|
||||
if (gmd != null)
|
||||
{
|
||||
if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
//m_log.DebugFormat("[PERMISSIONS]: Group member check took {0}", (DateTime.Now - t1).TotalMilliseconds);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -116,6 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="remoteClient"></param>
|
||||
public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: {0} requested full update for {1}", remoteClient.Name, primLocalID);
|
||||
|
||||
List<EntityBase> EntityList = GetEntities();
|
||||
|
||||
foreach (EntityBase ent in EntityList)
|
||||
|
@ -124,7 +126,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (((SceneObjectGroup)ent).LocalId == primLocalID)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: Received full update request for {0} from {1}", primLocalID, remoteClient.Name);
|
||||
((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2033,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void ScheduleGroupForFullUpdate()
|
||||
{
|
||||
// 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();
|
||||
RootPart.ScheduleFullUpdate();
|
||||
|
@ -2072,7 +2072,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (IsDeleted)
|
||||
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();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
|
@ -42,6 +43,7 @@ using OpenMetaverse.StructuredData;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
{
|
||||
|
@ -72,6 +74,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
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
|
||||
// Should be reset per agent, on logon
|
||||
|
@ -132,8 +136,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
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
|
||||
m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
|
||||
m_connectorEnabled = true;
|
||||
}
|
||||
}
|
||||
|
@ -920,6 +934,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
/// Encapsulate the XmlRpc call to standardize security and error handling.
|
||||
/// </summary>
|
||||
private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
|
||||
{
|
||||
XmlRpcResponse resp = null;
|
||||
string CacheKey = null;
|
||||
|
||||
// Only bother with the cache if it isn't disabled.
|
||||
if (m_cacheTimeout > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (resp == null)
|
||||
{
|
||||
string UserService;
|
||||
UUID SessionID;
|
||||
|
@ -947,11 +990,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
ConfigurableKeepAliveXmlRpcRequest req;
|
||||
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
|
||||
|
||||
XmlRpcResponse resp = null;
|
||||
|
||||
try
|
||||
{
|
||||
resp = req.Send(m_groupsServerURI, 10000);
|
||||
|
||||
if ((m_cacheTimeout > 0) && (CacheKey != null))
|
||||
{
|
||||
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -977,6 +1023,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
respData.Add("error", e.ToString());
|
||||
return respData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (resp.Value is Hashtable)
|
||||
|
|
Loading…
Reference in New Issue