aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/LLLoginService/LLLoginService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/LLLoginService/LLLoginService.cs')
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs40
1 files changed, 30 insertions, 10 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index a06476e..fcfdd1d 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq;
31using System.Net; 32using System.Net;
32using System.Reflection; 33using System.Reflection;
33using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
@@ -427,12 +428,9 @@ namespace OpenSim.Services.LLLoginService
427 { 428 {
428 m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", 429 m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region",
429 account.FirstName, account.LastName); 430 account.FirstName, account.LastName);
430 defaults = m_GridService.GetRegionsByName(scopeID, "", 1); 431 region = FindAlternativeRegion(scopeID);
431 if (defaults != null && defaults.Count > 0) 432 if (region != null)
432 {
433 region = defaults[0];
434 where = "safe"; 433 where = "safe";
435 }
436 } 434 }
437 } 435 }
438 436
@@ -459,12 +457,9 @@ namespace OpenSim.Services.LLLoginService
459 else 457 else
460 { 458 {
461 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); 459 m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
462 defaults = m_GridService.GetRegionsByName(scopeID, "", 1); 460 region = FindAlternativeRegion(scopeID);
463 if (defaults != null && defaults.Count > 0) 461 if (region != null)
464 {
465 region = defaults[0];
466 where = "safe"; 462 where = "safe";
467 }
468 } 463 }
469 464
470 } 465 }
@@ -564,6 +559,31 @@ namespace OpenSim.Services.LLLoginService
564 559
565 } 560 }
566 561
562 private GridRegion FindAlternativeRegion(UUID scopeID)
563 {
564 List<GridRegion> hyperlinks = null;
565 List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, 1000 * (int)Constants.RegionSize, 1000 * (int)Constants.RegionSize);
566 if (regions != null && regions.Count > 0)
567 {
568 hyperlinks = m_GridService.GetHyperlinks(scopeID);
569 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
570 if (availableRegions.Count() > 0)
571 return availableRegions.ElementAt(0);
572 }
573 // No fallbacks, try to find an arbitrary region that is not a hyperlink
574 // maxNumber is fixed for now; maybe use some search pattern with increasing maxSize here?
575 regions = m_GridService.GetRegionsByName(scopeID, "", 10);
576 if (regions != null && regions.Count > 0)
577 {
578 if (hyperlinks == null)
579 hyperlinks = m_GridService.GetHyperlinks(scopeID);
580 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
581 if (availableRegions.Count() > 0)
582 return availableRegions.ElementAt(0);
583 }
584 return null;
585 }
586
567 private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) 587 private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper)
568 { 588 {
569 gatekeeper = new GridRegion(); 589 gatekeeper = new GridRegion();