xmlrpcgroups: make use of a forgotten GetMemberGroupProfilemethod, put back xmlrpc cache since it is necessary to prevent folish viewers flooding

LSLKeyTest
UbitUmarov 2016-07-01 23:26:16 +01:00
parent 07c8e79b03
commit 057bc648f3
3 changed files with 23 additions and 15 deletions

View File

@ -785,6 +785,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
/*
GroupProfileData profile = new GroupProfileData();
@ -813,7 +814,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
profile.MemberTitle = memberInfo.GroupTitle;
profile.PowersMask = memberInfo.GroupPowers;
}
*/
UUID agent = GetRequestingAgentID(remoteClient);
GroupProfileData profile = m_groupData.GetMemberGroupProfile(agent, groupID, agent);
return profile;
}

View File

@ -51,6 +51,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
/// GroupID may be specified instead, in which case this parmeter will be null.
/// </param>
GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName);
GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID);
List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search);
List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID);

View File

@ -181,9 +181,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
// disable cache until it is fixed
m_cacheTimeout = 0;
if (m_cacheTimeout == 0)
{
m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
@ -385,10 +382,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID);
GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
if(MemberInfo != null)
{
MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
}
return MemberGroupProfile;
}
@ -977,12 +975,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
try
{
resp = req.Send(m_groupsServerURI, 30000);
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
resp = req.Send(m_groupsServerURI);
}
catch (Exception e)
{
@ -1004,12 +997,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString());
}
}
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0);
}
Hashtable respData = new Hashtable();
respData.Add("error", e.ToString());
return respData;
}
}
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
if (resp.Value is Hashtable)
{
Hashtable respData = (Hashtable)resp.Value;
@ -1138,6 +1141,7 @@ namespace Nwc.XmlRpc
request.ContentType = "text/xml";
request.AllowWriteStreamBuffering = true;
request.KeepAlive = !_disableKeepAlive;
request.Timeout = 30000;
using (Stream stream = request.GetRequestStream())
{