diff options
-rw-r--r-- | OpenSim/Framework/Communications/CommunicationsManager.cs | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 2410f31..9c02842 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -210,34 +210,17 @@ namespace OpenSim.Framework.Communications | |||
210 | private string[] doUUIDNameRequest(UUID uuid) | 210 | private string[] doUUIDNameRequest(UUID uuid) |
211 | { | 211 | { |
212 | string[] returnstring = new string[0]; | 212 | string[] returnstring = new string[0]; |
213 | bool doLookup = false; | 213 | CachedUserInfo uinfo = UserProfileCacheService.GetUserDetails(uuid); |
214 | 214 | ||
215 | lock (m_nameRequestCache) | 215 | if ((uinfo != null) && (uinfo.UserProfile != null)) |
216 | { | 216 | { |
217 | if (m_nameRequestCache.ContainsKey(uuid)) | 217 | returnstring = new string[2]; |
218 | { | 218 | returnstring[0] = uinfo.UserProfile.FirstName; |
219 | returnstring = m_nameRequestCache[uuid]; | 219 | returnstring[1] = uinfo.UserProfile.SurName; |
220 | } | 220 | lock (m_nameRequestCache) |
221 | else | ||
222 | { | ||
223 | // we don't want to lock the dictionary while we're doing the lookup | ||
224 | doLookup = true; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | if (doLookup) { | ||
229 | UserProfileData profileData = m_userService.GetUserProfile(uuid); | ||
230 | if (profileData != null) | ||
231 | { | 221 | { |
232 | returnstring = new string[2]; | 222 | if (!m_nameRequestCache.ContainsKey(uuid)) |
233 | // UUID profileId = profileData.ID; | 223 | m_nameRequestCache.Add(uuid, returnstring); |
234 | returnstring[0] = profileData.FirstName; | ||
235 | returnstring[1] = profileData.SurName; | ||
236 | lock (m_nameRequestCache) | ||
237 | { | ||
238 | if (!m_nameRequestCache.ContainsKey(uuid)) | ||
239 | m_nameRequestCache.Add(uuid, returnstring); | ||
240 | } | ||
241 | } | 224 | } |
242 | } | 225 | } |
243 | 226 | ||