From 0b91ec8dd2b78461cb0fcdec567a83e88a76ac87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 18:58:05 +0000 Subject: Migrate detailed "appearance show" report generation up to AvatarFactoryModule from AppearanceInfoModule so that it can be used in debug (inactive). Further filters "debug packet " to exclused [Request]ObjectPropertiesFamily if level is below 25. Adjust some method doc Minor changes to some logging messages. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 17 +++++-- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 57 +++++++++++++++++++--- .../Framework/Interfaces/IAvatarFactoryModule.cs | 11 ++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Avatar/Appearance/AppearanceInfoModule.cs | 34 +------------ 5 files changed, 74 insertions(+), 47 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8b41c49..f9a6643 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -441,6 +441,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo, UUID agentId, UUID sessionId, uint circuitCode) { +// DebugPacketLevel = 1; + RegisterInterface(this); RegisterInterface(this); RegisterInterface(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 try { - byte[] visualparams = new byte[appear.VisualParam.Length]; for (int i = 0; i < appear.VisualParam.Length; i++) visualparams[i] = appear.VisualParam[i].ParamValue; @@ -11219,9 +11220,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Send a response back to a client when it asks the asset server (via the region server) if it has /// its appearance texture cached. - /// - /// At the moment, we always reply that there is no cached texture. /// + /// + /// At the moment, we always reply that there is no cached texture. + /// /// /// /// @@ -11231,7 +11233,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 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 cachedresp.AgentData.AgentID = AgentId; @@ -11629,6 +11632,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (DebugPacketLevel <= 50 && packet.Type == PacketType.ImprovedTerseObjectUpdate) logPacket = false; + if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily) + logPacket = false; + if (logPacket) m_log.DebugFormat( "[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)) logPacket = false; + if (DebugPacketLevel <= 25 && packet.Type == PacketType.RequestObjectPropertiesFamily) + logPacket = false; + if (logPacket) m_log.DebugFormat( "[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}", diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 29e3580..f1a81ae 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -26,16 +26,15 @@ */ using System; +using System.Collections.Generic; using System.Reflection; +using System.Threading; +using System.Text; +using System.Timers; using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; - -using System.Threading; -using System.Timers; -using System.Collections.Generic; - using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; @@ -45,6 +44,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule { 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 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 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; - m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID); +// WriteBakedTexturesReport(sp, m_log.DebugFormat); ValidateBakedTextureCache(sp, false); // This appears to be set only in the final stage of the appearance @@ -254,9 +260,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } /// - /// Queue up a request to send appearance, makes it possible to - /// accumulate changes without sending out each one separately. + /// Queue up a request to send appearance. /// + /// + /// Makes it possible to accumulate changes without sending out each one separately. + /// + /// public void QueueAppearanceSend(UUID agentid) { // m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); @@ -557,5 +566,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } #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 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"); + } } } diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs index 26bc922..8670229 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs @@ -31,9 +31,10 @@ using OpenSim.Framework; namespace OpenSim.Region.Framework.Interfaces { + public delegate void ReportOutputAction(string format, params object[] args); + public interface IAvatarFactoryModule { - void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); /// @@ -63,5 +64,13 @@ namespace OpenSim.Region.Framework.Interfaces bool ValidateBakedTextureCache(IScenePresence sp); void QueueAppearanceSend(UUID agentid); void QueueAppearanceSave(UUID agentid); + + /// + /// Get a report about the current state of a scene presence's baked appearance textures. + /// + /// + /// + /// + void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction reportOutputAction); } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7be95cd..f2e2ce7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2667,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendAppearanceToAgent(ScenePresence avatar) { // 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( UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 40cbc60..1ce24f1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -50,8 +50,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}"; - private Dictionary m_scenes = new Dictionary(); // private IAvatarFactoryModule m_avatarFactory; @@ -197,37 +195,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance { ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); if (sp != null && !sp.IsChildAgent) - { - MainConsole.Instance.OutputFormat("For {0} in {1}", sp.Name, scene.RegionInfo.RegionName); - MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, "Bake Type", "UUID"); - - Dictionary 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"); - } + scene.AvatarFactory.WriteBakedTexturesReport(sp, MainConsole.Instance.OutputFormat); } else { -- cgit v1.1 From e8fbeeba5f2c02bf89ade1d8c0fa135d065096e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 19:08:24 +0000 Subject: Fix race condition where the appearance update timer could be stopped just after another thread had started it on QueueAppearanceSave() or *Send() However, the window for this race is very small, and the next queued appearance save or send would restart the timer anyway. --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index f1a81ae..e8aee3e 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -417,10 +417,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_savequeue.Remove(avatarID); } } - } - if (m_savequeue.Count == 0 && m_sendqueue.Count == 0) - m_updateTimer.Stop(); + // We must lock both queues here so that QueueAppearanceSave() or *Send() don't m_updateTimer.Start() on + // another thread inbetween the first count calls and m_updateTimer.Stop() on this thread. + lock (m_sendqueue) + if (m_savequeue.Count == 0 && m_sendqueue.Count == 0) + m_updateTimer.Stop(); + } } private void SaveAppearance(UUID agentid) -- cgit v1.1 From 2899de1a5c8060397e813ee853c525572a81db03 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 19:19:05 +0000 Subject: Stop unnecessarily sending the TextureEntry in client avatar updates. As far as I know, viewers don't use this mechanism to recieve new TextureEntry data for avatars. This is done via the AvatarAppearance packet instead. Tested this back to viewer 1.23. Replacing with Utils.EmptyBytes since converting the texture entry to bytes on each AvatarUpdate (or which there are many) is not cost-free. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f9a6643..b37fd54 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4895,8 +4895,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.Scale = new Vector3(0.45f, 0.6f, 1.9f); update.Text = Utils.EmptyBytes; update.TextColor = new byte[4]; + + // Don't send texture anim for avatars - this has no meaning for them. update.TextureAnim = Utils.EmptyBytes; - update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; + + // Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet + update.TextureEntry = Utils.EmptyBytes; +// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; + update.UpdateFlags = (uint)( PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | -- cgit v1.1 From 92039f295d7fe66bf1a09b29483f9057e395839e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Dec 2011 20:13:48 +0000 Subject: Stop sending the viewer its own AvatarAppearance packet. The viewer warns in the log if it receives this. Stopping this doesn't appear to have adverse effects on viewer 1 or viewer 3 - the viewer gets its own appearance from body parts/clothes and self-baked textures. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f2e2ce7..9cad3fe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2532,7 +2532,10 @@ namespace OpenSim.Region.Framework.Scenes // again here... this comes after the cached appearance check because the avatars // appearance goes into the avatar update packet SendAvatarDataToAllAgents(); - SendAppearanceToAgent(this); + + // Sending us our own appearance does not seem to be necessary, and the viewer warns in the log if you do + // this. +// SendAppearanceToAgent(this); // If we are using the the cached appearance then send it out to everyone if (cachedappearance) -- cgit v1.1