From c3ddf461880ded2bff0f9ca6bd6b956fbe4c23d5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 23 Oct 2010 00:18:56 +0200 Subject: Prevent database lookups on every avatar movement when land is set to group access. Fixes a massive performance degradation. --- .../Region/CoreModules/World/Land/LandObject.cs | 28 +++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/CoreModules/World') diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index bd1dd66..d0517b7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -290,28 +290,16 @@ namespace OpenSim.Region.CoreModules.World.Land public bool HasGroupAccess(UUID avatar) { - if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) + if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) { - IGroupsModule groupsModule = - m_scene.RequestModuleInterface(); + ScenePresence sp; + if (!m_scene.TryGetScenePresence(avatar, out sp)) + return false; - List agentGroups = new List(); - if (groupsModule != null) - { - GroupMembershipData[] GroupMembership = - groupsModule.GetMembershipData(avatar); - - if (GroupMembership != null) - { - for (int i = 0; i < GroupMembership.Length; i++) - { - if (LandData.GroupID == GroupMembership[i].GroupID) - { - return true; - } - } - } - } + if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) + return false; + + return true; } return false; } -- cgit v1.1