From 23809809751ca325d07ebbc615b7c70e58f1f5e6 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 1 Dec 2011 23:38:25 +0000 Subject: [PATCH] Stop performing the asset save part of baked texture uploading on the UploadBakedTexture cap asynchronously. This prevents a possible race condition where the client would be told all baked textures had updated before they were in the asset service. The client would then trigger a set appearance which, after a delay, would send the avatar appearance out to other clients. The race condition seems unlikely because of this delay but it's still possible. Might help with grey avatar appearances. --- .../UploadBakedTextureHandler.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 97b558cad7..b89fd6ab02 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -106,7 +106,7 @@ namespace OpenSim.Capabilities.Handlers } catch (Exception e) { - m_log.Error("[CAPS]: " + e.ToString()); + m_log.Error("[UPLOAD BAKED TEXTURE HANDLER]: " + e.ToString()); } return null; @@ -132,6 +132,8 @@ namespace OpenSim.Capabilities.Handlers class BakedTextureUploader { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event Action OnUpLoad; private string uploaderPath = String.Empty; @@ -156,10 +158,12 @@ namespace OpenSim.Capabilities.Handlers public string uploaderCaps(byte[] data, string path, string param) { Action handlerUpLoad = OnUpLoad; + + // Don't do this asynchronously, otherwise it's possible for the client to send set appearance information + // on another thread which might send out avatar updates before the asset has been put into the asset + // service. if (handlerUpLoad != null) - { - Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); }); - } + handlerUpLoad(newAssetID, data); string res = String.Empty; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); @@ -171,7 +175,7 @@ namespace OpenSim.Capabilities.Handlers httpListener.RemoveStreamHandler("POST", uploaderPath); - // m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); +// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID); return res; }