diff options
author | Sean Dague | 2008-05-19 19:08:59 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-19 19:08:59 +0000 |
commit | 9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9 (patch) | |
tree | c823e351a3796d145bc71aee402c18cb89b8fb25 /OpenSim/Region/Modules | |
parent | (from awebb) (diff) | |
download | opensim-SC_OLD-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.zip opensim-SC_OLD-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.tar.gz opensim-SC_OLD-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.tar.bz2 opensim-SC_OLD-9808f39b6f21c26ac0e8cf9c8a04cc8ab2bfa7e9.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Modules')
-rw-r--r-- | OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs | 204 |
1 files changed, 103 insertions, 101 deletions
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 | |||
59 | 59 | ||
60 | public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) | 60 | public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) |
61 | { | 61 | { |
62 | appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId); | ||
63 | return true; | ||
62 | 64 | ||
63 | //should only let one thread at a time do this part | 65 | // //should only let one thread at a time do this part |
64 | EventWaitHandle waitHandle = null; | 66 | // EventWaitHandle waitHandle = null; |
65 | bool fetchInProgress = false; | 67 | // bool fetchInProgress = false; |
66 | lock (m_syncLock) | 68 | // lock (m_syncLock) |
67 | { | 69 | // { |
68 | appearance = CheckCache(avatarId); | 70 | // appearance = CheckCache(avatarId); |
69 | if (appearance != null) | 71 | // if (appearance != null) |
70 | { | 72 | // { |
71 | return true; | 73 | // return true; |
72 | } | 74 | // } |
73 | |||
74 | //not in cache so check to see if another thread is already fetching it | ||
75 | if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle)) | ||
76 | { | ||
77 | fetchInProgress = true; | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | fetchInProgress = false; | ||
82 | |||
83 | //no thread already fetching this appearance, so add a wait handle to list | ||
84 | //for any following threads that want the same appearance | ||
85 | waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); | ||
86 | m_fetchesInProgress.Add(avatarId, waitHandle); | ||
87 | } | ||
88 | } | ||
89 | 75 | ||
90 | if (fetchInProgress) | 76 | // //not in cache so check to see if another thread is already fetching it |
91 | { | 77 | // if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle)) |
92 | waitHandle.WaitOne(); | 78 | // { |
93 | appearance = CheckCache(avatarId); | 79 | // fetchInProgress = true; |
94 | if (appearance != null) | 80 | // } |
95 | { | 81 | // else |
96 | waitHandle = null; | 82 | // { |
97 | return true; | 83 | // fetchInProgress = false; |
98 | } | ||
99 | else | ||
100 | { | ||
101 | waitHandle = null; | ||
102 | return false; | ||
103 | } | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | // BUG: !? (Reduced from 5000 to 500 by Adam) | ||
108 | Thread.Sleep(500); //why is this here? | ||
109 | |||
110 | //this is the first thread to request this appearance | ||
111 | //so let it check the db and if not found then create a default appearance | ||
112 | //and add that to the cache | ||
113 | appearance = CheckDatabase(avatarId); | ||
114 | if (appearance != null) | ||
115 | { | ||
116 | //appearance has now been added to cache so lets pulse any waiting threads | ||
117 | lock (m_syncLock) | ||
118 | { | ||
119 | m_fetchesInProgress.Remove(avatarId); | ||
120 | waitHandle.Set(); | ||
121 | } | ||
122 | // waitHandle.Close(); | ||
123 | waitHandle = null; | ||
124 | return true; | ||
125 | } | ||
126 | 84 | ||
127 | //not found a appearance for the user, so create a new default one | 85 | // //no thread already fetching this appearance, so add a wait handle to list |
128 | appearance = CreateDefault(avatarId); | 86 | // //for any following threads that want the same appearance |
129 | if (appearance != null) | 87 | // waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); |
130 | { | 88 | // m_fetchesInProgress.Add(avatarId, waitHandle); |
131 | //update database | 89 | // } |
132 | if (m_enablePersist) | 90 | // } |
133 | { | ||
134 | m_appearanceMapper.Add(avatarId.UUID, appearance); | ||
135 | } | ||
136 | 91 | ||
137 | //add appearance to dictionary cache | 92 | // if (fetchInProgress) |
138 | lock (m_avatarsAppearance) | 93 | // { |
139 | { | 94 | // waitHandle.WaitOne(); |
140 | m_avatarsAppearance[avatarId] = appearance; | 95 | // appearance = CheckCache(avatarId); |
141 | } | 96 | // if (appearance != null) |
97 | // { | ||
98 | // waitHandle = null; | ||
99 | // return true; | ||
100 | // } | ||
101 | // else | ||
102 | // { | ||
103 | // waitHandle = null; | ||
104 | // return false; | ||
105 | // } | ||
106 | // } | ||
107 | // else | ||
108 | // { | ||
109 | // // BUG: !? (Reduced from 5000 to 500 by Adam) | ||
110 | // Thread.Sleep(500); //why is this here? | ||
111 | |||
112 | // //this is the first thread to request this appearance | ||
113 | // //so let it check the db and if not found then create a default appearance | ||
114 | // //and add that to the cache | ||
115 | // appearance = CheckDatabase(avatarId); | ||
116 | // if (appearance != null) | ||
117 | // { | ||
118 | // //appearance has now been added to cache so lets pulse any waiting threads | ||
119 | // lock (m_syncLock) | ||
120 | // { | ||
121 | // m_fetchesInProgress.Remove(avatarId); | ||
122 | // waitHandle.Set(); | ||
123 | // } | ||
124 | // // waitHandle.Close(); | ||
125 | // waitHandle = null; | ||
126 | // return true; | ||
127 | // } | ||
142 | 128 | ||
143 | //appearance has now been added to cache so lets pulse any waiting threads | 129 | // //not found a appearance for the user, so create a new default one |
144 | lock (m_syncLock) | 130 | // appearance = CreateDefault(avatarId); |
145 | { | 131 | // if (appearance != null) |
146 | m_fetchesInProgress.Remove(avatarId); | 132 | // { |
147 | waitHandle.Set(); | 133 | // //update database |
148 | } | 134 | // if (m_enablePersist) |
149 | // waitHandle.Close(); | 135 | // { |
150 | waitHandle = null; | 136 | // m_appearanceMapper.Add(avatarId.UUID, appearance); |
151 | return true; | 137 | // } |
152 | } | 138 | |
153 | else | 139 | // //add appearance to dictionary cache |
154 | { | 140 | // lock (m_avatarsAppearance) |
155 | //something went wrong, so release the wait handle and remove it | 141 | // { |
156 | //all waiting threads will fail to find cached appearance | 142 | // m_avatarsAppearance[avatarId] = appearance; |
157 | //but its better for them to fail than wait for ever | 143 | // } |
158 | lock (m_syncLock) | 144 | |
159 | { | 145 | // //appearance has now been added to cache so lets pulse any waiting threads |
160 | m_fetchesInProgress.Remove(avatarId); | 146 | // lock (m_syncLock) |
161 | waitHandle.Set(); | 147 | // { |
162 | } | 148 | // m_fetchesInProgress.Remove(avatarId); |
163 | //waitHandle.Close(); | 149 | // waitHandle.Set(); |
164 | waitHandle = null; | 150 | // } |
165 | return false; | 151 | // // waitHandle.Close(); |
166 | } | 152 | // waitHandle = null; |
167 | } | 153 | // return true; |
154 | // } | ||
155 | // else | ||
156 | // { | ||
157 | // //something went wrong, so release the wait handle and remove it | ||
158 | // //all waiting threads will fail to find cached appearance | ||
159 | // //but its better for them to fail than wait for ever | ||
160 | // lock (m_syncLock) | ||
161 | // { | ||
162 | // m_fetchesInProgress.Remove(avatarId); | ||
163 | // waitHandle.Set(); | ||
164 | // } | ||
165 | // //waitHandle.Close(); | ||
166 | // waitHandle = null; | ||
167 | // return false; | ||
168 | // } | ||
169 | // } | ||
168 | } | 170 | } |
169 | 171 | ||
170 | private AvatarAppearance CreateDefault(LLUUID avatarId) | 172 | private AvatarAppearance CreateDefault(LLUUID avatarId) |