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. --- .../Services/HypergridService/GatekeeperService.cs | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 5c6abd2..24979be 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -391,13 +391,39 @@ namespace OpenSim.Services.HypergridService if(!m_allowDuplicatePresences) { +//// TODO - Should also check Presence.UserID if RegionID == UUID.Zero, they are a ghost. Maybe. +//// NOTE - this is a person hypergridding in, or returning home, or just logging in and it's duplicating effort in OpenSim/Services/LLLoginService/LLLoginService.cs. if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) { - if(SendAgentGodKillToRegion(UUID.Zero, agentID, 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. + + bool 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()) && (0 != String.Compare(pid["SessionID"].ToString(), aCircuit.SessionID.ToString()))) + { + m_log.WarnFormat("[GATEKEEPER SERVICE]: Exorcising ghost avatar {0}, session {1}, new session {2}.", pid["UserID"], pid["SessionID"], aCircuit.SessionID); +m_log.WarnFormat("[GATEKEEPER SERVICE]: NOT REALLY."); +//// Don't do this until after more checking. +//// success = m_PresenceService.LogoutAgent(new UUID(pid["SessionID"].ToString())); +//// if (success) +//// m_log.WarnFormat("[GATEKEEPER SERVICE]: Ghost avatar exorcised {0}, session {1}, new session {2}.", pid["UserID"], pid["SessionID"], aCircuit.SessionID); +//// else +//// m_log.ErrorFormat("[GATEKEEPER SERVICE]: Ghost avatar not exorcised {0}, session {1}, new session {2}!", pid["UserID"], pid["SessionID"], aCircuit.SessionID); + } + } + } + if ((!success) && SendAgentGodKillToRegion(UUID.Zero, agentID, guinfo)) { if(account != null) m_log.InfoFormat( - "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in", + "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in. This may be bogus if a ghost avatar was exorcised above.", account.FirstName, account.LastName); reason = "You appear to be already logged in on the destination grid " + "Please wait a a minute or two and retry. " + -- cgit v1.1