Migrate detailed "appearance show" report generation up to AvatarFactoryModule from AppearanceInfoModule so that it can be used in debug (inactive).

Further filters "debug packet <level>" to exclused [Request]ObjectPropertiesFamily if level is below 25.
Adjust some method doc
Minor changes to some logging messages.
iar_mods
Justin Clark-Casey (justincc) 2011-12-19 18:58:05 +00:00
parent 4d065f0453
commit 0b91ec8dd2
7 changed files with 90 additions and 56 deletions

View File

@ -104,7 +104,7 @@ namespace OpenSim.Capabilities.Handlers
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[UPLOAD BAKED TEXTURE HANDLER]: " + e.ToString()); m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
} }
return null; return null;
@ -117,7 +117,7 @@ namespace OpenSim.Capabilities.Handlers
/// <param name="data"></param> /// <param name="data"></param>
private void BakedTextureUploaded(UUID assetID, byte[] data) private void BakedTextureUploaded(UUID assetID, byte[] data)
{ {
// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); // m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
AssetBase asset; AssetBase asset;
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());

View File

@ -249,10 +249,12 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// Set up appearance textures. /// Set up appearance texture ids.
/// Returns boolean that indicates whether the new entries actually change the
/// existing values.
/// </summary> /// </summary>
/// <returns>
/// True if any existing texture id was changed by the new data.
/// False if there were no changes or no existing texture ids.
/// </returns>
public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry) public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry)
{ {
if (textureEntry == null) if (textureEntry == null)
@ -269,25 +271,30 @@ namespace OpenSim.Framework
if (newface == null) if (newface == null)
{ {
if (oldface == null) continue; if (oldface == null)
continue;
} }
else else
{ {
if (oldface != null && oldface.TextureID == newface.TextureID) continue; if (oldface != null && oldface.TextureID == newface.TextureID)
continue;
} }
changed = true; changed = true;
} }
m_texture = textureEntry; m_texture = textureEntry;
return changed; return changed;
} }
/// <summary> /// <summary>
/// Set up visual parameters for the avatar and refresh the avatar height /// Set up visual parameters for the avatar and refresh the avatar height
/// Returns boolean that indicates whether the new entries actually change the
/// existing values.
/// </summary> /// </summary>
/// <returns>
/// True if any existing visual parameter was changed by the new data.
/// False if there were no changes or no existing visual parameters.
/// </returns>
public virtual bool SetVisualParams(byte[] visualParams) public virtual bool SetVisualParams(byte[] visualParams)
{ {
if (visualParams == null) if (visualParams == null)

View File

@ -441,6 +441,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo, public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo,
UUID agentId, UUID sessionId, uint circuitCode) UUID agentId, UUID sessionId, uint circuitCode)
{ {
// DebugPacketLevel = 1;
RegisterInterface<IClientIM>(this); RegisterInterface<IClientIM>(this);
RegisterInterface<IClientChat>(this); RegisterInterface<IClientChat>(this);
RegisterInterface<IClientIPEndpoint>(this); RegisterInterface<IClientIPEndpoint>(this);
@ -6001,7 +6003,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// for the client session anyway, in order to protect ourselves against bad code in plugins // for the client session anyway, in order to protect ourselves against bad code in plugins
try try
{ {
byte[] visualparams = new byte[appear.VisualParam.Length]; byte[] visualparams = new byte[appear.VisualParam.Length];
for (int i = 0; i < appear.VisualParam.Length; i++) for (int i = 0; i < appear.VisualParam.Length; i++)
visualparams[i] = appear.VisualParam[i].ParamValue; visualparams[i] = appear.VisualParam[i].ParamValue;
@ -11219,9 +11220,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary> /// <summary>
/// Send a response back to a client when it asks the asset server (via the region server) if it has /// Send a response back to a client when it asks the asset server (via the region server) if it has
/// its appearance texture cached. /// its appearance texture cached.
///
/// At the moment, we always reply that there is no cached texture.
/// </summary> /// </summary>
/// <remarks>
/// At the moment, we always reply that there is no cached texture.
/// </remarks>
/// <param name="simclient"></param> /// <param name="simclient"></param>
/// <param name="packet"></param> /// <param name="packet"></param>
/// <returns></returns> /// <returns></returns>
@ -11231,7 +11233,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
if (cachedtex.AgentData.SessionID != SessionId) return false; if (cachedtex.AgentData.SessionID != SessionId)
return false;
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
cachedresp.AgentData.AgentID = AgentId; cachedresp.AgentData.AgentID = AgentId;
@ -11629,6 +11632,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (DebugPacketLevel <= 50 && packet.Type == PacketType.ImprovedTerseObjectUpdate) if (DebugPacketLevel <= 50 && packet.Type == PacketType.ImprovedTerseObjectUpdate)
logPacket = false; logPacket = false;
if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily)
logPacket = false;
if (logPacket) if (logPacket)
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}", "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}",
@ -11686,6 +11692,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
logPacket = false; logPacket = false;
if (DebugPacketLevel <= 25 && packet.Type == PacketType.RequestObjectPropertiesFamily)
logPacket = false;
if (logPacket) if (logPacket)
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}", "[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}",

View File

@ -26,16 +26,15 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading;
using System.Text;
using System.Timers;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using System.Threading;
using System.Timers;
using System.Collections.Generic;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -45,6 +44,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const string BAKED_TEXTURES_REPORT_FORMAT = "{0,-9} {1}";
private Scene m_scene = null; private Scene m_scene = null;
private int m_savetime = 5; // seconds to wait before saving changed appearance private int m_savetime = 5; // seconds to wait before saving changed appearance
@ -147,9 +149,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// Process the baked texture array // Process the baked texture array
if (textureEntry != null) if (textureEntry != null)
{ {
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID);
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID); // WriteBakedTexturesReport(sp, m_log.DebugFormat);
ValidateBakedTextureCache(sp, false); ValidateBakedTextureCache(sp, false);
// This appears to be set only in the final stage of the appearance // This appears to be set only in the final stage of the appearance
@ -254,9 +260,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
} }
/// <summary> /// <summary>
/// Queue up a request to send appearance, makes it possible to /// Queue up a request to send appearance.
/// accumulate changes without sending out each one separately.
/// </summary> /// </summary>
/// <remarks>
/// Makes it possible to accumulate changes without sending out each one separately.
/// </remarks>
/// <param name="agentId"></param>
public void QueueAppearanceSend(UUID agentid) public void QueueAppearanceSend(UUID agentid)
{ {
// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); // m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
@ -557,5 +566,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
} }
} }
#endregion #endregion
public void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction outputAction)
{
outputAction("For {0} in {1}", sp.Name, m_scene.RegionInfo.RegionName);
outputAction(BAKED_TEXTURES_REPORT_FORMAT, "Bake Type", "UUID");
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp.UUID);
foreach (BakeType bt in bakedTextures.Keys)
{
string rawTextureID;
if (bakedTextures[bt] == null)
{
rawTextureID = "not set";
}
else
{
rawTextureID = bakedTextures[bt].TextureID.ToString();
if (m_scene.AssetService.Get(rawTextureID) == null)
rawTextureID += " (not found)";
else
rawTextureID += " (uploaded)";
}
outputAction(BAKED_TEXTURES_REPORT_FORMAT, bt, rawTextureID);
}
bool bakedTextureValid = m_scene.AvatarFactory.ValidateBakedTextureCache(sp);
outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
}
} }
} }

View File

@ -31,9 +31,10 @@ using OpenSim.Framework;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public delegate void ReportOutputAction(string format, params object[] args);
public interface IAvatarFactoryModule public interface IAvatarFactoryModule
{ {
void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
/// <summary> /// <summary>
@ -63,5 +64,13 @@ namespace OpenSim.Region.Framework.Interfaces
bool ValidateBakedTextureCache(IScenePresence sp); bool ValidateBakedTextureCache(IScenePresence sp);
void QueueAppearanceSend(UUID agentid); void QueueAppearanceSend(UUID agentid);
void QueueAppearanceSave(UUID agentid); void QueueAppearanceSave(UUID agentid);
/// <summary>
/// Get a report about the current state of a scene presence's baked appearance textures.
/// </summary>
/// <param name="sp"></param>
/// <param name="reportOutputAction"></param>
/// <returns></returns>
void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction reportOutputAction);
} }
} }

View File

@ -2667,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendAppearanceToAgent(ScenePresence avatar) public void SendAppearanceToAgent(ScenePresence avatar)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAppearance( avatar.ControllingClient.SendAppearance(
UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());

View File

@ -50,8 +50,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}";
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
// private IAvatarFactoryModule m_avatarFactory; // private IAvatarFactoryModule m_avatarFactory;
@ -197,37 +195,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
{ {
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
if (sp != null && !sp.IsChildAgent) if (sp != null && !sp.IsChildAgent)
{ scene.AvatarFactory.WriteBakedTexturesReport(sp, MainConsole.Instance.OutputFormat);
MainConsole.Instance.OutputFormat("For {0} in {1}", sp.Name, scene.RegionInfo.RegionName);
MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, "Bake Type", "UUID");
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures
= scene.AvatarFactory.GetBakedTextureFaces(sp.UUID);
foreach (BakeType bt in bakedTextures.Keys)
{
string rawTextureID;
if (bakedTextures[bt] == null)
{
rawTextureID = "not set";
}
else
{
rawTextureID = bakedTextures[bt].TextureID.ToString();
if (scene.AssetService.Get(rawTextureID) == null)
rawTextureID += " (not found)";
else
rawTextureID += " (uploaded)";
}
MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, bt, rawTextureID);
}
bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp);
MainConsole.Instance.OutputFormat(
"{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
}
} }
else else
{ {