Select Random Region if Home or Last cant be found

slimupdates
unknown 2010-03-27 08:16:41 +13:00 committed by Diva Canto
parent dd1c1b3bcd
commit 9fb17e7ab2
1 changed files with 34 additions and 14 deletions

View File

@ -332,16 +332,24 @@ namespace OpenSim.Services.LLLoginService
if (tryDefaults) if (tryDefaults)
{ {
List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID); List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.ScopeID);
if (defaults != null && defaults.Count > 0) if (defaults != null && defaults.Count > 0)
{ {
region = defaults[0]; region = defaults[0];
where = "safe"; 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; return region;
@ -363,7 +371,18 @@ namespace OpenSim.Services.LLLoginService
{ {
region = defaults[0]; region = defaults[0];
where = "safe"; 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 else
{ {
@ -374,7 +393,7 @@ namespace OpenSim.Services.LLLoginService
return region; return region;
} }
else else
{ {
// free uri form // free uri form
// e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34 // e.g. New Moon&135&46 New Moon@osgrid.org:8002&153&34
where = "url"; where = "url";
@ -395,8 +414,7 @@ namespace OpenSim.Services.LLLoginService
if (regionName != null) if (regionName != null)
{ {
if (!regionName.Contains("@")) if (!regionName.Contains("@"))
{ {
List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1); List<GridRegion> regions = m_GridService.GetRegionsByName(account.ScopeID, regionName, 1);
if ((regions == null) || (regions != null && regions.Count == 0)) if ((regions == null) || (regions != null && regions.Count == 0))
{ {
@ -416,7 +434,7 @@ namespace OpenSim.Services.LLLoginService
return regions[0]; return regions[0];
} }
else else
{ {
if (m_UserAgentService == null) 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"); 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); m_log.InfoFormat("[LLLOGIN SERVICE]: Got Custom Login URI {0}, can't locate region {1}", startLocation, regionName);
return null; return null;
} }
// Valid specification of a remote grid // Valid specification of a remote grid
regionName = parts[0]; regionName = parts[0];
string domainLocator = parts[1]; string domainLocator = parts[1];
parts = domainLocator.Split(new char[] {':'}); parts = domainLocator.Split(new char[] {':'});
@ -436,6 +455,7 @@ namespace OpenSim.Services.LLLoginService
uint port = 0; uint port = 0;
if (parts.Length > 1) if (parts.Length > 1)
UInt32.TryParse(parts[1], out port); UInt32.TryParse(parts[1], out port);
GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper); GridRegion region = FindForeignRegion(domainName, port, regionName, out gatekeeper);
return region; return region;
} }