From f74aafaf633c84d645a7bb0fde1e09c410bfa4d3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 15 Feb 2014 01:13:58 +0000 Subject: [PATCH] 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 --- .../UserAccountService/GridUserService.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index bfc27b518c..5aa2078e9e 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs @@ -120,11 +120,13 @@ namespace OpenSim.Services.UserAccountService MainConsole.Instance.OutputFormat("Users online: {0}", onlineRecentlyCount); } - public virtual GridUserInfo GetGridUserInfo(string userID) + private GridUserData GetGridUserData(string userID) { GridUserData d = null; if (userID.Length > 36) // it's a UUI + { d = m_Database.Get(userID); + } else // it's a UUID { 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) return null; @@ -173,7 +182,8 @@ namespace OpenSim.Services.UserAccountService public GridUserInfo LoggedIn(string 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) { @@ -192,7 +202,8 @@ namespace OpenSim.Services.UserAccountService public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) { m_log.DebugFormat("[GRID USER SERVICE]: User {0} is offline", userID); - GridUserData d = m_Database.Get(userID); + + GridUserData d = GetGridUserData(userID); if (d == null) { @@ -211,7 +222,8 @@ namespace OpenSim.Services.UserAccountService public bool SetHome(string userID, UUID homeID, Vector3 homePosition, Vector3 homeLookAt) { - GridUserData d = m_Database.Get(userID); + GridUserData d = GetGridUserData(userID); + if (d == null) { d = new GridUserData(); @@ -229,7 +241,8 @@ namespace OpenSim.Services.UserAccountService { // m_log.DebugFormat("[GRID USER SERVICE]: SetLastPosition for {0}", userID); - GridUserData d = m_Database.Get(userID); + GridUserData d = GetGridUserData(userID); + if (d == null) { d = new GridUserData(); @@ -243,4 +256,4 @@ namespace OpenSim.Services.UserAccountService return m_Database.Store(d); } } -} +} \ No newline at end of file