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/Services/LLLoginService/LLLoginService.cs | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/LLLoginService/LLLoginService.cs') diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 53a3c2f..cad0988 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -390,7 +390,30 @@ namespace OpenSim.Services.LLLoginService { if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) { - if(SendAgentGodKillToRegion(scopeID, account.PrincipalID, guinfo)) + // Also check Presence.UserID if RegionID == UUID.Zero, they are a ghost. + // Ghosting might be caused by failure to call PresenceService.LogoutAgent() on logout / crash / failed login. + // Might also need to double check if they are out hypergridding. + + success = false; + if (m_PresenceService != null) + { + PresenceInfo pi = m_PresenceService.GetAgentByUser(account.PrincipalID); + if (null != pi) + { + Dictionary pid = pi.ToKeyValuePairs(); + if (pid["RegionID"].ToString() == UUID.Zero.ToString()) + { + m_log.WarnFormat("[LLOGIN SERVICE]: Exorcising ghost avatar {0} {1}, session {2}, new session {3}.", firstName, lastName, pid["SessionID"], session); + success = m_PresenceService.LogoutAgent(new UUID(pid["SessionID"].ToString())); + if (success) + m_log.WarnFormat("[LLOGIN SERVICE]: Ghost avatar exorcised {0} {1}, session {2}, new session {3}.", firstName, lastName, pid["SessionID"], session); + else + m_log.ErrorFormat("[LLOGIN SERVICE]: Ghost avatar not exorcised {0} {1}, session {2}, new session {3}!", firstName, lastName, pid["SessionID"], session); + } + } + } + + if ((!success) && SendAgentGodKillToRegion(scopeID, account.PrincipalID, guinfo)) { m_log.InfoFormat( "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: already logged in", -- cgit v1.1