From 3d9b73c47a15cf00150ac80570fea88de8cecbdf Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Aug 2013 23:19:31 +0100 Subject: [PATCH] Implement ability for hg logins to try fallback regions just like local logins. These would be specified in the [GridService] section of Robust.HG.ini, which already lists these in the example text. Untested patch so that Neb can easily pull in for testing, though shouldn't disrupt existing hg logins since fallback processing is a bit of code stuck on the end of the login sequence. --- .../HypergridService/GatekeeperService.cs | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0a3e70b5d5..cbe1af0603 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -326,7 +326,7 @@ namespace OpenSim.Services.HypergridService return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK"); + m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); bool isFirstLogin = false; // @@ -345,7 +345,7 @@ namespace OpenSim.Services.HypergridService aCircuit.firstname, aCircuit.lastname); return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); // Also login foreigners with GridUser service if (m_GridUserService != null && account == null) @@ -376,7 +376,8 @@ namespace OpenSim.Services.HypergridService reason = "Destination region not found"; return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok: {0}", destination.RegionName); + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name); // // Adjust the visible name @@ -410,8 +411,41 @@ namespace OpenSim.Services.HypergridService // Preserve our TeleportFlags we have gathered so-far loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; - m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); - return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); + + bool success = m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); + + if (!success) + { + List fallbackRegions = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY); + if (fallbackRegions != null) + { + // Try the fallback regions + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Could not successfully log agent {0} into {1}. Trying fallback regions.", + aCircuit.Name, destination.RegionName); + + foreach (GridRegion fallbackRegion in fallbackRegions) + { + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Trying fallback region {0} for {1}", + fallbackRegion.RegionName, aCircuit.Name); + + success = m_SimulationService.CreateAgent(fallbackRegion, aCircuit, (uint)loginFlag, out reason); + + if (success) + break; + } + } + else + { + m_log.DebugFormat( + "[GATEKEEPER SERVICE]: Could not successfully log agent {0} into {1} and no fallback regions to try.", + aCircuit.Name, destination.RegionName); + } + } + + return success; } protected bool Authenticate(AgentCircuitData aCircuit)