From 7aecb3c7d9262b7dcd43b45736bb008a2f1ca742 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 15 Aug 2019 02:18:35 +1000 Subject: Bandaid for ghost users, check and remove them from Presence when they log on. Once again OOP proves it's worse that spaghetti, but cutting up the spaghetti and hiding it all over the kitchen. Note the commented out bits from GateKeeperService.cs, this stuff is checked TWICE, though this time is for HGers, or not. --- OpenSim/Data/IPresenceData.cs | 1 + OpenSim/Data/MySQL/MySQLPresenceData.cs | 13 +++++++++++-- OpenSim/Data/Null/NullPresenceData.cs | 13 +++++++++++++ OpenSim/Data/PGSQL/PGSQLPresenceData.cs | 10 ++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 4086245..b026995 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs @@ -49,6 +49,7 @@ namespace OpenSim.Data bool Store(PresenceData data); PresenceData Get(UUID sessionID); + PresenceData GetByUser(UUID userID); void LogoutRegionAgents(UUID regionID); bool ReportAgent(UUID sessionID, UUID regionID); PresenceData[] Get(string field, string data); diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 70aca5f..b9114eb 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs @@ -52,8 +52,17 @@ namespace OpenSim.Data.MySQL public PresenceData Get(UUID sessionID) { - PresenceData[] ret = Get("SessionID", - sessionID.ToString()); + PresenceData[] ret = Get("SessionID", sessionID.ToString()); + + if (ret.Length == 0) + return null; + + return ret[0]; + } + + public PresenceData GetByUser(UUID userID) + { + PresenceData[] ret = Get("UserID", userID.ToString()); if (ret.Length == 0) return null; diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs index 8c442c9..ce1404e 100644 --- a/OpenSim/Data/Null/NullPresenceData.cs +++ b/OpenSim/Data/Null/NullPresenceData.cs @@ -79,6 +79,19 @@ namespace OpenSim.Data.Null return null; } + public PresenceData GetByUser(UUID userID) + { + if (Instance != this) + return Instance.GetByUser(userID); + + if (m_presenceData.ContainsKey(userID)) + { + return m_presenceData[userID]; + } + + return null; + } + public void LogoutRegionAgents(UUID regionID) { if (Instance != this) diff --git a/OpenSim/Data/PGSQL/PGSQLPresenceData.cs b/OpenSim/Data/PGSQL/PGSQLPresenceData.cs index ebbe8d3..51154af 100644 --- a/OpenSim/Data/PGSQL/PGSQLPresenceData.cs +++ b/OpenSim/Data/PGSQL/PGSQLPresenceData.cs @@ -60,6 +60,16 @@ namespace OpenSim.Data.PGSQL return ret[0]; } + public PresenceData GetByUser(UUID userID) + { + PresenceData[] ret = Get("UserID", userID.ToString()); + + if (ret.Length == 0) + return null; + + return ret[0]; + } + public void LogoutRegionAgents(UUID regionID) { using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) -- cgit v1.1