From 3d9b73c47a15cf00150ac80570fea88de8cecbdf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Aug 2013 23:19:31 +0100 Subject: 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. --- .../Services/HypergridService/GatekeeperService.cs | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0a3e70b..cbe1af0 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) -- cgit v1.1 From bcb8605f8428a9009a2badf9c9eed06d9f59962c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 01:20:01 +0100 Subject: Revert "Implement ability for hg logins to try fallback regions just like local logins." This approach does not work - it is taking place too far down the login process where really the region checking could only be done when the hg map tiles are linked on the main map (messy and probably impossible) or possibly when the final destination is fetched at the very first stage of teleport (which couldn't be done without a protocol change to pass the agentID as well as the requested regionID) This reverts commit 3d9b73c47a15cf00150ac80570fea88de8cecbdf. --- .../Services/HypergridService/GatekeeperService.cs | 44 +++------------------- 1 file changed, 5 insertions(+), 39 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index cbe1af0..0a3e70b 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 {0} is ok", aCircuit.Name); + m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK"); bool isFirstLogin = false; // @@ -345,7 +345,7 @@ namespace OpenSim.Services.HypergridService aCircuit.firstname, aCircuit.lastname); return false; } - m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); // Also login foreigners with GridUser service if (m_GridUserService != null && account == null) @@ -376,8 +376,7 @@ namespace OpenSim.Services.HypergridService reason = "Destination region not found"; return false; } - m_log.DebugFormat( - "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name); + m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok: {0}", destination.RegionName); // // Adjust the visible name @@ -411,41 +410,8 @@ namespace OpenSim.Services.HypergridService // Preserve our TeleportFlags we have gathered so-far loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; - 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; + m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); + return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1 From 689cf2d3670ab4f9493acd5ef5adec4f446a4a47 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 01:24:55 +0100 Subject: minor: Make logging in GatekeeperService.LoginAgent() a bit more detailed so that we can distinguish between simultaneous logins --- OpenSim/Services/HypergridService/GatekeeperService.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 0a3e70b..e10c4cb 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,8 @@ 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 +377,9 @@ 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,7 +413,8 @@ 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); + m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); + return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } -- cgit v1.1 From c7a8afbb8da40e09252d58d95c89b8a99a684157 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 24 Aug 2013 03:41:56 -0700 Subject: Make HG logins fall back to fallback regions if the desired region fails. --- .../Services/HypergridService/GatekeeperService.cs | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index e10c4cb..4a6b079 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -72,11 +72,14 @@ namespace OpenSim.Services.HypergridService private static Uri m_Uri; private static GridRegion m_DefaultGatewayRegion; + private static Random m_Random; + public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; + m_Random = new Random(); IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) @@ -220,6 +223,8 @@ namespace OpenSim.Services.HypergridService public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) { reason = string.Empty; + List defaultRegions; + List fallbackRegions; string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) @@ -374,8 +379,14 @@ namespace OpenSim.Services.HypergridService destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); if (destination == null) { - reason = "Destination region not found"; - return false; + defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); + if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0)) + { + reason = "Destination region not found"; + return false; + } + int index = m_Random.Next(0, defaultRegions.Count - 1); + destination = defaultRegions[index]; } m_log.DebugFormat( @@ -415,7 +426,17 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); - return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); + // try login to the desired region + if (m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason)) + return true; + + // if that failed, try the fallbacks + fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); + foreach (GridRegion r in fallbackRegions) + if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) + return true; + + return false; } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1 From ec32c1d4b69e4219fe44a38bcbc411e7996641f1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 24 Aug 2013 09:59:05 -0700 Subject: Added some more debug messages. --- OpenSim/Services/HypergridService/GatekeeperService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 4a6b079..00502b1 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -431,11 +431,14 @@ namespace OpenSim.Services.HypergridService return true; // if that failed, try the fallbacks + m_log.DebugFormat("[GATEKEEPER SERVICE]: Region {0} did not accept agent {1}", destination.RegionName, aCircuit.Name); fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); foreach (GridRegion r in fallbackRegions) + { + m_log.DebugFormat("[GATEKEEPER SERVICE]: Trying region {0}...", r.RegionName); if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) return true; - + } return false; } -- cgit v1.1 From 1b2830b929640544b6b19ee56b436a5a54d8d0d5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Aug 2013 21:05:55 +0100 Subject: Revert "Added some more debug messages." Fallback doesn't work at this level as the change of destination isn't communicated to the source region/viewer Reverting because this introduces a bug when access does fail. More detail in revert of main commit. This reverts commit ec32c1d4b69e4219fe44a38bcbc411e7996641f1. --- OpenSim/Services/HypergridService/GatekeeperService.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 00502b1..4a6b079 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -431,14 +431,11 @@ namespace OpenSim.Services.HypergridService return true; // if that failed, try the fallbacks - m_log.DebugFormat("[GATEKEEPER SERVICE]: Region {0} did not accept agent {1}", destination.RegionName, aCircuit.Name); fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); foreach (GridRegion r in fallbackRegions) - { - m_log.DebugFormat("[GATEKEEPER SERVICE]: Trying region {0}...", r.RegionName); if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) return true; - } + return false; } -- cgit v1.1 From 0dd9a68eb74a7374f72cbed14c6e0eacdb642b60 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Aug 2013 21:07:49 +0100 Subject: Revert "Make HG logins fall back to fallback regions if the desired region fails." This is very similar to my earlier revert in bcb8605f8428a9009a2badf9c9eed06d9f59962c and fails for the same reasons. Reverting this change because it causes a problem if access is denied to the user. This reverts commit c7a8afbb8da40e09252d58d95c89b8a99a684157. --- .../Services/HypergridService/GatekeeperService.cs | 27 +++------------------- 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 4a6b079..e10c4cb 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -72,14 +72,11 @@ namespace OpenSim.Services.HypergridService private static Uri m_Uri; private static GridRegion m_DefaultGatewayRegion; - private static Random m_Random; - public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; - m_Random = new Random(); IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) @@ -223,8 +220,6 @@ namespace OpenSim.Services.HypergridService public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) { reason = string.Empty; - List defaultRegions; - List fallbackRegions; string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) @@ -379,14 +374,8 @@ namespace OpenSim.Services.HypergridService destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); if (destination == null) { - defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); - if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0)) - { - reason = "Destination region not found"; - return false; - } - int index = m_Random.Next(0, defaultRegions.Count - 1); - destination = defaultRegions[index]; + reason = "Destination region not found"; + return false; } m_log.DebugFormat( @@ -426,17 +415,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); - // try login to the desired region - if (m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason)) - return true; - - // if that failed, try the fallbacks - fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); - foreach (GridRegion r in fallbackRegions) - if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) - return true; - - return false; + return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } protected bool Authenticate(AgentCircuitData aCircuit) -- cgit v1.1