In GridUserService, if a UUID is given consistently use the longest matched entry (as already done by GetGridUserInfo()) in order to avoid problems with multiple entries.

This is to avoid issues where LoggedIn, SetHome, etc were always using the exact UUID match but GetGridUserInfo() would use the longest.
Looks to address http://opensimulator.org/mantis/view.php?id=6986
justincc-master
Justin Clark-Casey (justincc) 2014-02-15 01:13:58 +00:00
parent f49d513089
commit f74aafaf63
1 changed files with 19 additions and 6 deletions

View File

@ -120,11 +120,13 @@ namespace OpenSim.Services.UserAccountService
MainConsole.Instance.OutputFormat("Users online: {0}", onlineRecentlyCount); MainConsole.Instance.OutputFormat("Users online: {0}", onlineRecentlyCount);
} }
public virtual GridUserInfo GetGridUserInfo(string userID) private GridUserData GetGridUserData(string userID)
{ {
GridUserData d = null; GridUserData d = null;
if (userID.Length > 36) // it's a UUI if (userID.Length > 36) // it's a UUI
{
d = m_Database.Get(userID); d = m_Database.Get(userID);
}
else // it's a UUID else // it's a UUID
{ {
GridUserData[] ds = m_Database.GetAll(userID); GridUserData[] ds = m_Database.GetAll(userID);
@ -140,6 +142,13 @@ namespace OpenSim.Services.UserAccountService
} }
} }
return d;
}
public virtual GridUserInfo GetGridUserInfo(string userID)
{
GridUserData d = GetGridUserData(userID);
if (d == null) if (d == null)
return null; return null;
@ -173,7 +182,8 @@ namespace OpenSim.Services.UserAccountService
public GridUserInfo LoggedIn(string userID) public GridUserInfo LoggedIn(string userID)
{ {
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID); m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID);
GridUserData d = m_Database.Get(userID);
GridUserData d = GetGridUserData(userID);
if (d == null) if (d == null)
{ {
@ -192,7 +202,8 @@ namespace OpenSim.Services.UserAccountService
public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
{ {
m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID); m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID);
GridUserData d = m_Database.Get(userID);
GridUserData d = GetGridUserData(userID);
if (d == null) if (d == null)
{ {
@ -211,7 +222,8 @@ namespace OpenSim.Services.UserAccountService
public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt)
{ {
GridUserData d = m_Database.Get(userID); GridUserData d = GetGridUserData(userID);
if (d == null) if (d == null)
{ {
d = new GridUserData(); d = new GridUserData();
@ -229,7 +241,8 @@ namespace OpenSim.Services.UserAccountService
{ {
// m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID); // m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID);
GridUserData d = m_Database.Get(userID); GridUserData d = GetGridUserData(userID);
if (d == null) if (d == null)
{ {
d = new GridUserData(); d = new GridUserData();