diff options
author | Melanie | 2012-03-18 20:44:56 +0000 |
---|---|---|
committer | Melanie | 2012-03-18 20:44:56 +0000 |
commit | c7e302864a2eef7f9587ed22286c96a6074ac5b3 (patch) | |
tree | 8f0df2f66811309fd790966770434fa3ff68bfdf /OpenSim/Region/CoreModules/World/Estate | |
parent | Merge branch 'ubitwork' (diff) | |
parent | Amend to previous commit: normalize strings ToLower. (diff) | |
download | opensim-SC-c7e302864a2eef7f9587ed22286c96a6074ac5b3.zip opensim-SC-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.gz opensim-SC-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.bz2 opensim-SC-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 123 |
1 files changed, 51 insertions, 72 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 35f47d2..b95bda5 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -26,8 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.IO; | 31 | using System.IO; |
32 | using System.Linq; | ||
31 | using System.Reflection; | 33 | using System.Reflection; |
32 | using System.Security; | 34 | using System.Security; |
33 | using System.Timers; | 35 | using System.Timers; |
@@ -46,8 +48,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
46 | { | 48 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 50 | ||
49 | private delegate void LookupUUIDS(List<UUID> uuidLst); | ||
50 | |||
51 | private Timer m_regionChangeTimer = new Timer(); | 51 | private Timer m_regionChangeTimer = new Timer(); |
52 | public Scene Scene { get; private set; } | 52 | public Scene Scene { get; private set; } |
53 | public IUserManagement UserManager { get; private set; } | 53 | public IUserManagement UserManager { get; private set; } |
@@ -907,98 +907,77 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
907 | if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) | 907 | if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) |
908 | return; | 908 | return; |
909 | 909 | ||
910 | Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); | 910 | Dictionary<uint, float> sceneData = null; |
911 | List<UUID> uuidNameLookupList = new List<UUID>(); | 911 | List<UUID> uuidNameLookupList = new List<UUID>(); |
912 | 912 | ||
913 | if (reportType == 1) | 913 | if (reportType == 1) |
914 | { | 914 | { |
915 | SceneData = Scene.PhysicsScene.GetTopColliders(); | 915 | sceneData = Scene.PhysicsScene.GetTopColliders(); |
916 | } | 916 | } |
917 | else if (reportType == 0) | 917 | else if (reportType == 0) |
918 | { | 918 | { |
919 | SceneData = Scene.SceneGraph.GetTopScripts(); | 919 | IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>(); |
920 | |||
921 | if (scriptModule != null) | ||
922 | sceneData = scriptModule.GetObjectScriptsExecutionTimes(); | ||
920 | } | 923 | } |
921 | 924 | ||
922 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); | 925 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); |
923 | lock (SceneData) | 926 | if (sceneData != null) |
924 | { | 927 | { |
925 | foreach (uint obj in SceneData.Keys) | 928 | var sortedSceneData |
929 | = sceneData.Select( | ||
930 | item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) }); | ||
931 | |||
932 | sortedSceneData.OrderBy(item => item.Measurement); | ||
933 | |||
934 | int items = 0; | ||
935 | |||
936 | foreach (var entry in sortedSceneData) | ||
926 | { | 937 | { |
927 | SceneObjectPart prt = Scene.GetSceneObjectPart(obj); | 938 | // The object may have been deleted since we received the data. |
928 | if (prt != null) | 939 | if (entry.Part == null) |
940 | continue; | ||
941 | |||
942 | // Don't show scripts that haven't executed or where execution time is below one microsecond in | ||
943 | // order to produce a more readable report. | ||
944 | if (entry.Measurement < 0.001) | ||
945 | continue; | ||
946 | |||
947 | items++; | ||
948 | SceneObjectGroup so = entry.Part.ParentGroup; | ||
949 | |||
950 | LandStatReportItem lsri = new LandStatReportItem(); | ||
951 | lsri.LocationX = so.AbsolutePosition.X; | ||
952 | lsri.LocationY = so.AbsolutePosition.Y; | ||
953 | lsri.LocationZ = so.AbsolutePosition.Z; | ||
954 | lsri.Score = entry.Measurement; | ||
955 | lsri.TaskID = so.UUID; | ||
956 | lsri.TaskLocalID = so.LocalId; | ||
957 | lsri.TaskName = entry.Part.Name; | ||
958 | lsri.OwnerName = UserManager.GetUserName(so.OwnerID); | ||
959 | |||
960 | if (filter.Length != 0) | ||
929 | { | 961 | { |
930 | SceneObjectGroup sog = prt.ParentGroup; | 962 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) |
931 | LandStatReportItem lsri = new LandStatReportItem(); | ||
932 | lsri.LocationX = sog.AbsolutePosition.X; | ||
933 | lsri.LocationY = sog.AbsolutePosition.Y; | ||
934 | lsri.LocationZ = sog.AbsolutePosition.Z; | ||
935 | lsri.Score = SceneData[obj]; | ||
936 | lsri.TaskID = sog.UUID; | ||
937 | lsri.TaskLocalID = sog.LocalId; | ||
938 | lsri.TaskName = sog.GetPartName(obj); | ||
939 | lsri.OwnerName = "waiting"; | ||
940 | lock (uuidNameLookupList) | ||
941 | uuidNameLookupList.Add(sog.OwnerID); | ||
942 | |||
943 | if (filter.Length != 0) | ||
944 | { | 963 | { |
945 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) | ||
946 | { | ||
947 | } | ||
948 | else | ||
949 | { | ||
950 | continue; | ||
951 | } | ||
952 | } | 964 | } |
953 | 965 | else | |
954 | SceneReport.Add(lsri); | 966 | { |
967 | continue; | ||
968 | } | ||
955 | } | 969 | } |
970 | |||
971 | SceneReport.Add(lsri); | ||
972 | |||
973 | if (items >= 100) | ||
974 | break; | ||
956 | } | 975 | } |
957 | } | 976 | } |
958 | 977 | ||
959 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); | 978 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); |
960 | |||
961 | if (uuidNameLookupList.Count > 0) | ||
962 | LookupUUID(uuidNameLookupList); | ||
963 | } | 979 | } |
964 | 980 | ||
965 | private static void LookupUUIDSCompleted(IAsyncResult iar) | ||
966 | { | ||
967 | LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; | ||
968 | icon.EndInvoke(iar); | ||
969 | } | ||
970 | |||
971 | private void LookupUUID(List<UUID> uuidLst) | ||
972 | { | ||
973 | LookupUUIDS d = LookupUUIDsAsync; | ||
974 | |||
975 | d.BeginInvoke(uuidLst, | ||
976 | LookupUUIDSCompleted, | ||
977 | d); | ||
978 | } | ||
979 | |||
980 | private void LookupUUIDsAsync(List<UUID> uuidLst) | ||
981 | { | ||
982 | UUID[] uuidarr; | ||
983 | |||
984 | lock (uuidLst) | ||
985 | { | ||
986 | uuidarr = uuidLst.ToArray(); | ||
987 | } | ||
988 | |||
989 | for (int i = 0; i < uuidarr.Length; i++) | ||
990 | { | ||
991 | // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | ||
992 | |||
993 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | ||
994 | if (userManager != null) | ||
995 | userManager.GetUserName(uuidarr[i]); | ||
996 | |||
997 | // we drop it. It gets cached though... so we're ready for the next request. | ||
998 | // diva commnent 11/21/2010: uh?!? wft? | ||
999 | // justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume. | ||
1000 | } | ||
1001 | } | ||
1002 | #endregion | 981 | #endregion |
1003 | 982 | ||
1004 | #region Outgoing Packets | 983 | #region Outgoing Packets |