mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
* 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.
This commit is contained in:
@@ -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<LLUUID> 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<uint, float> SceneData = new Dictionary<uint,float>();
|
||||
List<LLUUID> uuidNameLookupList = new List<LLUUID>();
|
||||
|
||||
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<LLUUID> uuidLst)
|
||||
{
|
||||
LookupUUIDS d = LookupUUIDsAsync;
|
||||
|
||||
d.BeginInvoke(uuidLst,
|
||||
LookupUUIDSCompleted,
|
||||
d);
|
||||
}
|
||||
private void LookupUUIDsAsync(List<LLUUID> 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
|
||||
|
||||
Reference in New Issue
Block a user