take friends out of basicDOSprot (too little, too late)

0.9.1.0-post-fixes
UbitUmarov 2018-11-14 17:49:05 +00:00
parent 35f5d4449b
commit afb1d6cdd7
2 changed files with 20 additions and 13 deletions

View File

@ -42,12 +42,14 @@ using log4net;
namespace OpenSim.Region.CoreModules.Avatar.Friends namespace OpenSim.Region.CoreModules.Avatar.Friends
{ {
public class FriendsRequestHandler : BaseStreamHandlerBasicDOSProtector
// public class FriendsRequestHandler : BaseStreamHandlerBasicDOSProtector
public class FriendsRequestHandler : BaseStreamHandler
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private FriendsModule m_FriendsModule; private FriendsModule m_FriendsModule;
/*
public FriendsRequestHandler(FriendsModule fmodule) public FriendsRequestHandler(FriendsModule fmodule)
: base("POST", "/friends", new BasicDosProtectorOptions() : base("POST", "/friends", new BasicDosProtectorOptions()
{ {
@ -58,6 +60,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
RequestTimeSpan = TimeSpan.FromSeconds(5), RequestTimeSpan = TimeSpan.FromSeconds(5),
ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
}) })
*/
public FriendsRequestHandler(FriendsModule fmodule)
: base("POST", "/friends")
{ {
m_FriendsModule = fmodule; m_FriendsModule = fmodule;
} }

View File

@ -170,6 +170,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// we do this only for the root agent // we do this only for the root agent
if (m_Friends[agentID].Refcount == 1) if (m_Friends[agentID].Refcount == 1)
{ {
IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
if(uMan == null)
return true;
// We need to preload the user management cache with the names // We need to preload the user management cache with the names
// of foreign friends, just like we do with SOPs' creators // of foreign friends, just like we do with SOPs' creators
foreach (FriendInfo finfo in m_Friends[agentID].Friends) foreach (FriendInfo finfo in m_Friends[agentID].Friends)
@ -182,8 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty; string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp)) if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp))
{ {
IUserManagement uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); // m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend);
m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend);
uMan.AddUser(id, url + ";" + first + " " + last); uMan.AddUser(id, url + ";" + first + " " + last);
} }
} }