From 9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 19 May 2008 19:08:59 +0000 Subject: i can haz pantz? You sure can. This change set restores pants (and the rest of the default appearance) in grid mode. The root issue had to do with serializing multi-faced textures to the grid server. This also restores the lookup path through the avatar factory module, as that seems the reasonable place to have it live. Some clean up patches are coming later as well, plus testing on standalone, but this should be in a good kicking around state for grid users. --- .../Modules/AvatarFactory/AvatarFactoryModule.cs | 204 +++++++++++---------- 1 file changed, 103 insertions(+), 101 deletions(-) (limited to 'OpenSim/Region/Modules/AvatarFactory') diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs index 3ac8e9a..7dae702 100644 --- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs @@ -59,112 +59,114 @@ namespace OpenSim.Region.Modules.AvatarFactory public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) { + appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId); + return true; - //should only let one thread at a time do this part - EventWaitHandle waitHandle = null; - bool fetchInProgress = false; - lock (m_syncLock) - { - appearance = CheckCache(avatarId); - if (appearance != null) - { - return true; - } - - //not in cache so check to see if another thread is already fetching it - if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle)) - { - fetchInProgress = true; - } - else - { - fetchInProgress = false; - - //no thread already fetching this appearance, so add a wait handle to list - //for any following threads that want the same appearance - waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); - m_fetchesInProgress.Add(avatarId, waitHandle); - } - } + // //should only let one thread at a time do this part + // EventWaitHandle waitHandle = null; + // bool fetchInProgress = false; + // lock (m_syncLock) + // { + // appearance = CheckCache(avatarId); + // if (appearance != null) + // { + // return true; + // } - if (fetchInProgress) - { - waitHandle.WaitOne(); - appearance = CheckCache(avatarId); - if (appearance != null) - { - waitHandle = null; - return true; - } - else - { - waitHandle = null; - return false; - } - } - else - { - // BUG: !? (Reduced from 5000 to 500 by Adam) - Thread.Sleep(500); //why is this here? - - //this is the first thread to request this appearance - //so let it check the db and if not found then create a default appearance - //and add that to the cache - appearance = CheckDatabase(avatarId); - if (appearance != null) - { - //appearance has now been added to cache so lets pulse any waiting threads - lock (m_syncLock) - { - m_fetchesInProgress.Remove(avatarId); - waitHandle.Set(); - } - // waitHandle.Close(); - waitHandle = null; - return true; - } + // //not in cache so check to see if another thread is already fetching it + // if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle)) + // { + // fetchInProgress = true; + // } + // else + // { + // fetchInProgress = false; - //not found a appearance for the user, so create a new default one - appearance = CreateDefault(avatarId); - if (appearance != null) - { - //update database - if (m_enablePersist) - { - m_appearanceMapper.Add(avatarId.UUID, appearance); - } + // //no thread already fetching this appearance, so add a wait handle to list + // //for any following threads that want the same appearance + // waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); + // m_fetchesInProgress.Add(avatarId, waitHandle); + // } + // } - //add appearance to dictionary cache - lock (m_avatarsAppearance) - { - m_avatarsAppearance[avatarId] = appearance; - } + // if (fetchInProgress) + // { + // waitHandle.WaitOne(); + // appearance = CheckCache(avatarId); + // if (appearance != null) + // { + // waitHandle = null; + // return true; + // } + // else + // { + // waitHandle = null; + // return false; + // } + // } + // else + // { + // // BUG: !? (Reduced from 5000 to 500 by Adam) + // Thread.Sleep(500); //why is this here? + + // //this is the first thread to request this appearance + // //so let it check the db and if not found then create a default appearance + // //and add that to the cache + // appearance = CheckDatabase(avatarId); + // if (appearance != null) + // { + // //appearance has now been added to cache so lets pulse any waiting threads + // lock (m_syncLock) + // { + // m_fetchesInProgress.Remove(avatarId); + // waitHandle.Set(); + // } + // // waitHandle.Close(); + // waitHandle = null; + // return true; + // } - //appearance has now been added to cache so lets pulse any waiting threads - lock (m_syncLock) - { - m_fetchesInProgress.Remove(avatarId); - waitHandle.Set(); - } - // waitHandle.Close(); - waitHandle = null; - return true; - } - else - { - //something went wrong, so release the wait handle and remove it - //all waiting threads will fail to find cached appearance - //but its better for them to fail than wait for ever - lock (m_syncLock) - { - m_fetchesInProgress.Remove(avatarId); - waitHandle.Set(); - } - //waitHandle.Close(); - waitHandle = null; - return false; - } - } + // //not found a appearance for the user, so create a new default one + // appearance = CreateDefault(avatarId); + // if (appearance != null) + // { + // //update database + // if (m_enablePersist) + // { + // m_appearanceMapper.Add(avatarId.UUID, appearance); + // } + + // //add appearance to dictionary cache + // lock (m_avatarsAppearance) + // { + // m_avatarsAppearance[avatarId] = appearance; + // } + + // //appearance has now been added to cache so lets pulse any waiting threads + // lock (m_syncLock) + // { + // m_fetchesInProgress.Remove(avatarId); + // waitHandle.Set(); + // } + // // waitHandle.Close(); + // waitHandle = null; + // return true; + // } + // else + // { + // //something went wrong, so release the wait handle and remove it + // //all waiting threads will fail to find cached appearance + // //but its better for them to fail than wait for ever + // lock (m_syncLock) + // { + // m_fetchesInProgress.Remove(avatarId); + // waitHandle.Set(); + // } + // //waitHandle.Close(); + // waitHandle = null; + // return false; + // } + // } } private AvatarAppearance CreateDefault(LLUUID avatarId) -- cgit v1.1