From 039d91928488f313a88b390a4c5cbe6e76ff3618 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Tue, 11 Jan 2011 19:19:15 -0800 Subject: [PATCH] RefreshAppearance now tries to find the local avatar a few times before it gives up. --- .../AvatarFactory/AvatarFactoryModule.cs | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 5b5889df0d..d8e7914d55 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_savetime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); m_sendtime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); - // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); + m_log.WarnFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); } } @@ -261,6 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory m_sendqueue[agentid] = timestamp; m_updateTimer.Start(); } + m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0} at {1} (now is {2})", agentid, timestamp,DateTime.Now.Ticks); } public void QueueAppearanceSave(UUID agentid) @@ -278,16 +279,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void RefreshAppearance(UUID agentid) { - ScenePresence sp; - if(!m_scene.TryGetScenePresence(agentid, out sp)) - { - m_log.WarnFormat("[AVFACTORY]: RefreshAppearance unable to find presence for {0}", agentid); - return; - } m_log.DebugFormat("[AVFACTORY]: FireAndForget called for RefreshAppearance on agentid {0}", agentid); Util.FireAndForget(delegate(object o) { - AvatarAppearance appearance = m_scene.AvatarService.GetAppearance(agentid); + int trycount = 20; + ScenePresence sp; + while (!m_scene.TryGetScenePresence(agentid, out sp)) + { + m_log.WarnFormat("[AVFACTORY]: RefreshAppearance unable to find presence for {0}", agentid); + Thread.Sleep(500); + if (trycount-- <= 0) + return; + } + trycount = 5; + AvatarAppearance appearance = null; + while (appearance == null) + { + try + { + appearance = m_scene.AvatarService.GetAppearance(agentid); + } + catch (System.Net.WebException e) + { + if (trycount-- <= 0) + { + m_log.WarnFormat("[AVFACTORY]: RefreshAppearance failed to get appearance from AvatarService: {0}", e.Message); + return; + } + } + Thread.Sleep(500); + } + if (appearance.Texture != null && appearance.VisualParams != null) { sp.Appearance = appearance; @@ -353,6 +375,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { if (kvp.Value < now) { + m_log.WarnFormat("[AVFACTORY]: send appearance for {0} at time {1}", kvp.Key, now); Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); m_sendqueue.Remove(kvp.Key); }