From bdb365015b67d5b9b8646c97fc41047bb16f6175 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 9 Sep 2020 20:24:55 +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, by 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 e7816c2..7aa18b1 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -412,7 +412,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