Refactor a lot of direct calls to OGS1 to use the cached version instead.

Scripts can now no longer DOS the user server and there are a lot fewer
gratuitious lookups of user profile data.
0.6.0-stable
Melanie Thielker 2008-08-16 02:00:36 +00:00
parent 437b4a8aaa
commit 328ab79b78
9 changed files with 63 additions and 38 deletions

View File

@ -39,6 +39,7 @@ using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{
@ -589,10 +590,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{
// try avatar username surname
Scene scene = GetRandomScene();
UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(agentID);
if (profile != null)
CachedUserInfo profile = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
if (profile != null && profile.UserProfile != null)
{
string avatarname = profile.FirstName + " " + profile.SurName;
string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
return avatarname;
}
return String.Empty;

View File

@ -29,6 +29,7 @@ using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.World.Serialiser;
using OpenSim.Region.Environment.Modules.World.Terrain;
using OpenSim.Framework.Communications.Cache;
using System;
using Axiom.Math;
using System.Collections.Generic;
@ -187,7 +188,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
if (!m_validUserUuids.ContainsKey(uuid))
{
if (m_scene.CommsManager.UserService.GetUserProfile(uuid) != null)
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(uuid);
if (profile != null && profile.UserProfile != null)
m_validUserUuids.Add(uuid, true);
else
m_validUserUuids.Add(uuid, false);

View File

@ -3777,22 +3777,5 @@ namespace OpenSim.Region.Environment.Scenes
//Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised());
}
// public bool IsAdministrator(LLUUID user)
// {
// if(RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero)
// {
// if(RegionInfo.MasterAvatarAssignedUUID == user)
// return true;
// }
//
// UserProfileData userProfile =
// CommsManager.UserService.GetUserProfile(user);
//
// if(userProfile.GodLevel >= 200)
// return true;
//
// return false;
// }
}
}

View File

@ -2026,13 +2026,12 @@ namespace OpenSim.Region.Environment.Scenes
{
if (godStatus)
{
// TODO: remove this cruft once the master avatar is fully
// deprecated. For now, assign god level 200 to anyone
// For now, assign god level 200 to anyone
// who is granted god powers, but has no god level set.
//
UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(agentID);
if(userProfile.GodLevel > 0)
m_godlevel = userProfile.GodLevel;
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
if(profile.UserProfile.GodLevel > 0)
m_godlevel = profile.UserProfile.GodLevel;
else
m_godlevel = 200;
}

View File

@ -645,10 +645,10 @@ namespace OpenSim.Region.ScriptEngine.Common
public string resolveName(LLUUID objecUUID)
{
// try avatar username surname
UserProfileData profile = World.CommsManager.UserService.GetUserProfile(objecUUID);
if (profile != null)
CachedUserInfo profile = World.CommsManager.UserProfileCacheService.GetUserDetails(objecUUID);
if (profile != null && profile.UserProfile != null)
{
string avatarname = profile.FirstName + " " + profile.SurName;
string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
return avatarname;
}
// try an scene object

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins
{
@ -272,10 +273,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
string entname =ent.Name;
// try avatar username surname
UserProfileData profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserService.GetUserProfile(ent.UUID);
if (profile != null)
CachedUserInfo profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserProfileCacheService.GetUserDetails(ent.UUID);
if (profile != null && profile.UserProfile != null)
{
avatarname = profile.FirstName + " " + profile.SurName;
avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
}
// try an scene object
SceneObjectPart SOP = m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(ent.UUID);

View File

@ -633,10 +633,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string resolveName(LLUUID objecUUID)
{
// try avatar username surname
UserProfileData profile = World.CommsManager.UserService.GetUserProfile(objecUUID);
if (profile != null)
CachedUserInfo profile = World.CommsManager.UserProfileCacheService.GetUserDetails(objecUUID);
if (profile != null && profile.UserProfile != null)
{
string avatarname = profile.FirstName + " " + profile.SurName;
string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
return avatarname;
}
// try an scene object

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api;
@ -263,10 +264,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
string entname =ent.Name;
// try avatar username surname
UserProfileData profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserService.GetUserProfile(ent.UUID);
if (profile != null)
CachedUserInfo profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserProfileCacheService.GetUserDetails(ent.UUID);
if (profile != null && profile.UserProfile != null)
{
avatarname = profile.FirstName + " " + profile.SurName;
avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
}
// try an scene object
SceneObjectPart SOP = m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(ent.UUID);

View File

@ -816,6 +816,44 @@
</Files>
</Project>
<Project name="Xumeo.Modules" path="Xumeo/Modules" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/>
<Reference name="System.Drawing"/>
<Reference name="System.Runtime.Remoting"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Axiom.MathLib.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data" />
<Reference name="OpenSim.Region.Environment" />
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="System.Data" />
<Reference name="MySql.Data.dll" />
<Reference name="Nini.dll" />
<Reference name="log4net.dll"/>
<Reference name="XMLRPC.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.Region.ClientStack" path="OpenSim/Region/ClientStack" type="Library">
<Configuration name="Debug">
<Options>