From 9fb17e7ab235cdf21b2b0865aadf31e3f63bd018 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Mar 2010 08:16:41 +1300 Subject: [PATCH] Select Random Region if Home or Last cant be found --- .../Services/LLLoginService/LLLoginService.cs | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 1eaf4d4158..9846364cd9 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -332,16 +332,24 @@ namespace OpenSim.Services.LLLoginService if (tryDefaults) { - List defaults = m_GridService.GetDefaultRegions(account.ScopeID); - if (defaults != null && defaults.Count > 0) - { - region = defaults[0]; - where = "safe"; + List defaults = m_GridService.GetDefaultRegions(account.ScopeID); + if (defaults != null && defaults.Count > 0) + { + region = defaults[0]; + where = "safe"; + } + else + { + m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations.", + account.FirstName, account.LastName); + m_log.Info("[LLOGIN SERVICE]: Home Region Not Found Attempting to find random region"); + defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); + if (defaults != null && defaults.Count > 0) + { + region = defaults[0]; + where = "safe"; + } } - else - m_log.WarnFormat( - "[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations.", - account.FirstName, account.LastName); } return region; @@ -363,7 +371,18 @@ namespace OpenSim.Services.LLLoginService { region = defaults[0]; where = "safe"; + } + else + { + m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); + defaults = m_GridService.GetRegionsByName(account.ScopeID, "", 1); + if (defaults != null && defaults.Count > 0) + { + region = defaults[0]; + where = "safe"; + } } + } else { @@ -374,7 +393,7 @@ namespace OpenSim.Services.LLLoginService return region; } else - { + { // free uri form // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34 where = "url"; @@ -395,8 +414,7 @@ namespace OpenSim.Services.LLLoginService if (regionName != null) { if (!regionName.Contains("@")) - { - + { List regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); if ((regions == null) || (regions != null && regions.Count == 0)) { @@ -416,7 +434,7 @@ namespace OpenSim.Services.LLLoginService return regions[0]; } else - { + { if (m_UserAgentService == null) { m_log.WarnFormat("[LLLOGIN SERVICE]: This llogin service is not running a user agent service, as such it can't lauch agents at foreign grids"); @@ -428,7 +446,8 @@ namespace OpenSim.Services.LLLoginService m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}", startLocation, regionName); return null; } - // Valid specification of a remote grid + // Valid specification of a remote grid + regionName = parts[0]; string domainLocator = parts[1]; parts = domainLocator.Split(new char[] {':'}); @@ -436,6 +455,7 @@ namespace OpenSim.Services.LLLoginService uint port = 0; if (parts.Length > 1) UInt32.TryParse(parts[1], out port); + GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper); return region; }