From 9cefda83d6d54edc9ed1587bb71e9cb8fb2d17d5 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 29 May 2008 23:36:37 +0000 Subject: * Caches UUIDName requests * Looks up UUIDNames for script time and colliders in a separate thread. * Hopefully this'll allow you to look at top scripts on a region that has a lot of scripts without crashing your client thread. --- .../Modules/World/Estate/EstateManagementModule.cs | 48 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index ab5898d..6c63c36 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -24,7 +24,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +using System; +using System.Threading; using System.Collections.Generic; using System.Reflection; using libsecondlife; @@ -40,6 +41,8 @@ namespace OpenSim.Region.Environment.Modules.World.Estate { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private delegate void LookupUUIDS(List uuidLst); + private Scene m_scene; #region Packet Data Responders @@ -314,6 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) { Dictionary SceneData = new Dictionary(); + List uuidNameLookupList = new List(); if (reportType == 1) { @@ -345,7 +349,17 @@ namespace OpenSim.Region.Environment.Modules.World.Estate lsri.TaskID = sog.UUID; lsri.TaskLocalID = sog.LocalId; lsri.TaskName = sog.GetPartName(obj); - lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID); + if (m_scene.CommsManager.UUIDNameCachedTest(sog.OwnerID)) + { + lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID); + } + else + { + lsri.OwnerName = "waiting"; + lock(uuidNameLookupList) + uuidNameLookupList.Add(sog.OwnerID); + } + if (filter.Length != 0) { if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) @@ -365,9 +379,39 @@ namespace OpenSim.Region.Environment.Modules.World.Estate } } remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); + + if (uuidNameLookupList.Count > 0) + LookupUUID(uuidNameLookupList); + } + + private void LookupUUIDSCompleted(IAsyncResult iar) + { + LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; + icon.EndInvoke(iar); + } + private void LookupUUID(List uuidLst) + { + LookupUUIDS d = LookupUUIDsAsync; + d.BeginInvoke(uuidLst, + LookupUUIDSCompleted, + d); } + private void LookupUUIDsAsync(List uuidLst) + { + LLUUID[] uuidarr = new LLUUID[0]; + + lock (uuidLst) + { + uuidarr = uuidLst.ToArray(); + } + for (int i = 0; i < uuidarr.Length; i++) + { + string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); + // we drop it. It gets cached though... so we're ready for the next request. + } + } #endregion #region Outgoing Packets -- cgit v1.1