aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-05-21 17:45:15 +0100
committerJustin Clark-Casey (justincc)2013-05-21 17:45:15 +0100
commitc47de9878dd8af19fa9b4322a8a49646712ebf9b (patch)
treed4e8f73fa7deb6ebf7f5d9b466fdc9a6e38cece1
parentLock m_UserCache whilst iterating over it in UserManagementModule.GetUserData... (diff)
downloadopensim-SC-c47de9878dd8af19fa9b4322a8a49646712ebf9b.zip
opensim-SC-c47de9878dd8af19fa9b4322a8a49646712ebf9b.tar.gz
opensim-SC-c47de9878dd8af19fa9b4322a8a49646712ebf9b.tar.bz2
opensim-SC-c47de9878dd8af19fa9b4322a8a49646712ebf9b.tar.xz
Log when "Unknown User" is sent to a user because the UMM had no binding for that UUID and when a binding replaces a previous "Unknown User" entry.
This is a temporary measure to hunt down issues where some but not all users see others as "Unknown user" in text chat, etc. http://opensimulator.org/mantis/view.php?id=6625
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs49
1 files changed, 32 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index d99c8eb..06f1712 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -157,13 +157,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
157 } 157 }
158 else 158 else
159 { 159 {
160 string[] names = GetUserNames(uuid); 160 string[] names;
161 bool foundRealName = TryGetUserNames(uuid, out names);
162
161 if (names.Length == 2) 163 if (names.Length == 2)
162 { 164 {
163 //m_log.DebugFormat("[XXX] HandleUUIDNameRequest {0} is {1} {2}", uuid, names[0], names[1]); 165 if (!foundRealName)
166 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], uuid, remote_client.Name);
167
164 remote_client.SendNameReply(uuid, names[0], names[1]); 168 remote_client.SendNameReply(uuid, names[0], names[1]);
165 } 169 }
166
167 } 170 }
168 } 171 }
169 172
@@ -277,17 +280,24 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
277 } 280 }
278 } 281 }
279 282
280 private string[] GetUserNames(UUID uuid) 283 /// <summary>
284 /// Try to get the names bound to the given uuid.
285 /// </summary>
286 /// <returns>True if the name was found, false if not.</returns>
287 /// <param name='uuid'></param>
288 /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param>
289 private bool TryGetUserNames(UUID uuid, out string[] names)
281 { 290 {
282 string[] returnstring = new string[2]; 291 names = new string[2];
283 292
284 lock (m_UserCache) 293 lock (m_UserCache)
285 { 294 {
286 if (m_UserCache.ContainsKey(uuid)) 295 if (m_UserCache.ContainsKey(uuid))
287 { 296 {
288 returnstring[0] = m_UserCache[uuid].FirstName; 297 names[0] = m_UserCache[uuid].FirstName;
289 returnstring[1] = m_UserCache[uuid].LastName; 298 names[1] = m_UserCache[uuid].LastName;
290 return returnstring; 299
300 return true;
291 } 301 }
292 } 302 }
293 303
@@ -295,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
295 305
296 if (account != null) 306 if (account != null)
297 { 307 {
298 returnstring[0] = account.FirstName; 308 names[0] = account.FirstName;
299 returnstring[1] = account.LastName; 309 names[1] = account.LastName;
300 310
301 UserData user = new UserData(); 311 UserData user = new UserData();
302 user.FirstName = account.FirstName; 312 user.FirstName = account.FirstName;
@@ -304,14 +314,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
304 314
305 lock (m_UserCache) 315 lock (m_UserCache)
306 m_UserCache[uuid] = user; 316 m_UserCache[uuid] = user;
317
318 return true;
307 } 319 }
308 else 320 else
309 { 321 {
310 returnstring[0] = "Unknown"; 322 names[0] = "Unknown";
311 returnstring[1] = "User"; 323 names[1] = "User";
312 }
313 324
314 return returnstring; 325 return false;
326 }
315 } 327 }
316 328
317 #region IUserManagement 329 #region IUserManagement
@@ -347,15 +359,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
347 359
348 public string GetUserName(UUID uuid) 360 public string GetUserName(UUID uuid)
349 { 361 {
350 string[] names = GetUserNames(uuid); 362 string[] names;
363 TryGetUserNames(uuid, out names);
364
351 if (names.Length == 2) 365 if (names.Length == 2)
352 { 366 {
353 string firstname = names[0]; 367 string firstname = names[0];
354 string lastname = names[1]; 368 string lastname = names[1];
355 369
356 return firstname + " " + lastname; 370 return firstname + " " + lastname;
357
358 } 371 }
372
359 return "(hippos)"; 373 return "(hippos)";
360 } 374 }
361 375
@@ -471,12 +485,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
471 //ignore updates without creator data 485 //ignore updates without creator data
472 return; 486 return;
473 } 487 }
488
474 //try update unknown users 489 //try update unknown users
475 //and creator's home URL's 490 //and creator's home URL's
476 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) 491 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
477 { 492 {
478 m_UserCache.Remove (id); 493 m_UserCache.Remove (id);
479// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); 494 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
480 } 495 }
481 else 496 else
482 { 497 {