From afb1d6cdd742dd7acfac1b3ac8ac62a523cddb4c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Nov 2018 17:49:05 +0000 Subject: [PATCH] take friends out of basicDOSprot (too little, too late) --- .../Avatar/Friends/FriendsRequestHandler.cs | 27 +++++++++++-------- .../Avatar/Friends/HGFriendsModule.cs | 6 +++-- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index 091b1975e4..29c2e8e256 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs @@ -42,22 +42,27 @@ using log4net; 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 FriendsModule m_FriendsModule; - + /* + public FriendsRequestHandler(FriendsModule fmodule) + : base("POST", "/friends", new BasicDosProtectorOptions() + { + AllowXForwardedFor = true, + ForgetTimeSpan = TimeSpan.FromMinutes(2), + MaxRequestsInTimeframe = 20, + ReportingName = "FRIENDSDOSPROTECTOR", + RequestTimeSpan = TimeSpan.FromSeconds(5), + ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod + }) + */ public FriendsRequestHandler(FriendsModule fmodule) - : base("POST", "/friends", new BasicDosProtectorOptions() - { - AllowXForwardedFor = true, - ForgetTimeSpan = TimeSpan.FromMinutes(2), - MaxRequestsInTimeframe = 20, - ReportingName = "FRIENDSDOSPROTECTOR", - RequestTimeSpan = TimeSpan.FromSeconds(5), - ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod - }) + : base("POST", "/friends") { m_FriendsModule = fmodule; } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index fae1e05349..c042f658b2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -170,6 +170,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // we do this only for the root agent if (m_Friends[agentID].Refcount == 1) { + IUserManagement uMan = m_Scenes[0].RequestModuleInterface(); + if(uMan == null) + return true; // We need to preload the user management cache with the names // of foreign friends, just like we do with SOPs' creators 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; if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp)) { - IUserManagement uMan = m_Scenes[0].RequestModuleInterface(); - m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend); +// m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend); uMan.AddUser(id, url + ";" + first + " " + last); } }