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); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
/*
GroupProfileData profile = new GroupProfileData(); GroupProfileData profile = new GroupProfileData();
@ -813,7 +814,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
profile.MemberTitle = memberInfo.GroupTitle; profile.MemberTitle = memberInfo.GroupTitle;
profile.PowersMask = memberInfo.GroupPowers; profile.PowersMask = memberInfo.GroupPowers;
} }
*/
UUID agent = GetRequestingAgentID(remoteClient);
GroupProfileData profile = m_groupData.GetMemberGroupProfile(agent, groupID, agent);
return profile; 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. /// GroupID may be specified instead, in which case this parmeter will be null.
/// </param> /// </param>
GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName);
GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID);
List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search);
List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); 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); m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
// disable cache until it is fixed
m_cacheTimeout = 0;
if (m_cacheTimeout == 0) if (m_cacheTimeout == 0)
{ {
m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); 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); GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID);
GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
if(MemberInfo != null)
{
MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
}
return MemberGroupProfile; return MemberGroupProfile;
} }
@ -977,12 +975,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
try try
{ {
resp = req.Send(m_groupsServerURI, 30000); resp = req.Send(m_groupsServerURI);
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
} }
catch (Exception e) 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()); 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(); Hashtable respData = new Hashtable();
respData.Add("error", e.ToString()); respData.Add("error", e.ToString());
return respData; return respData;
} }
} }
if ((m_cacheTimeout > 0) && (CacheKey != null))
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
if (resp.Value is Hashtable) if (resp.Value is Hashtable)
{ {
Hashtable respData = (Hashtable)resp.Value; Hashtable respData = (Hashtable)resp.Value;
@ -1138,6 +1141,7 @@ namespace Nwc.XmlRpc
request.ContentType = "text/xml"; request.ContentType = "text/xml";
request.AllowWriteStreamBuffering = true; request.AllowWriteStreamBuffering = true;
request.KeepAlive = !_disableKeepAlive; request.KeepAlive = !_disableKeepAlive;
request.Timeout = 30000;
using (Stream stream = request.GetRequestStream()) using (Stream stream = request.GetRequestStream())
{ {