diff options
author | Melanie | 2010-11-17 18:21:35 +0000 |
---|---|---|
committer | Melanie | 2010-11-17 18:21:35 +0000 |
commit | 3bc9c1adb4b4ed9d372e40d5cbd9d257b73c8816 (patch) | |
tree | 2c25eecf06d4dae3045b6ce5c66719ef15a27517 /OpenSim/Services/LLLoginService/LLLoginService.cs | |
parent | Fix gesture and viewer preview sounds not playing (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-3bc9c1adb4b4ed9d372e40d5cbd9d257b73c8816.zip opensim-SC-3bc9c1adb4b4ed9d372e40d5cbd9d257b73c8816.tar.gz opensim-SC-3bc9c1adb4b4ed9d372e40d5cbd9d257b73c8816.tar.bz2 opensim-SC-3bc9c1adb4b4ed9d372e40d5cbd9d257b73c8816.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/LLLoginService/LLLoginService.cs')
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 1d3c412..35adf0f 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | ||
31 | using System.Net; | 32 | using System.Net; |
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using System.Text.RegularExpressions; | 34 | using System.Text.RegularExpressions; |
@@ -433,12 +434,9 @@ namespace OpenSim.Services.LLLoginService | |||
433 | { | 434 | { |
434 | 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", | 435 | 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", |
435 | account.FirstName, account.LastName); | 436 | account.FirstName, account.LastName); |
436 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); | 437 | region = FindAlternativeRegion(scopeID); |
437 | if (defaults != null && defaults.Count > 0) | 438 | if (region != null) |
438 | { | ||
439 | region = defaults[0]; | ||
440 | where = "safe"; | 439 | where = "safe"; |
441 | } | ||
442 | } | 440 | } |
443 | } | 441 | } |
444 | 442 | ||
@@ -465,12 +463,9 @@ namespace OpenSim.Services.LLLoginService | |||
465 | else | 463 | else |
466 | { | 464 | { |
467 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); | 465 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); |
468 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); | 466 | region = FindAlternativeRegion(scopeID); |
469 | if (defaults != null && defaults.Count > 0) | 467 | if (region != null) |
470 | { | ||
471 | region = defaults[0]; | ||
472 | where = "safe"; | 468 | where = "safe"; |
473 | } | ||
474 | } | 469 | } |
475 | 470 | ||
476 | } | 471 | } |
@@ -570,6 +565,31 @@ namespace OpenSim.Services.LLLoginService | |||
570 | 565 | ||
571 | } | 566 | } |
572 | 567 | ||
568 | private GridRegion FindAlternativeRegion(UUID scopeID) | ||
569 | { | ||
570 | List<GridRegion> hyperlinks = null; | ||
571 | List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, 1000 * (int)Constants.RegionSize, 1000 * (int)Constants.RegionSize); | ||
572 | if (regions != null && regions.Count > 0) | ||
573 | { | ||
574 | hyperlinks = m_GridService.GetHyperlinks(scopeID); | ||
575 | IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); | ||
576 | if (availableRegions.Count() > 0) | ||
577 | return availableRegions.ElementAt(0); | ||
578 | } | ||
579 | // No fallbacks, try to find an arbitrary region that is not a hyperlink | ||
580 | // maxNumber is fixed for now; maybe use some search pattern with increasing maxSize here? | ||
581 | regions = m_GridService.GetRegionsByName(scopeID, "", 10); | ||
582 | if (regions != null && regions.Count > 0) | ||
583 | { | ||
584 | if (hyperlinks == null) | ||
585 | hyperlinks = m_GridService.GetHyperlinks(scopeID); | ||
586 | IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); | ||
587 | if (availableRegions.Count() > 0) | ||
588 | return availableRegions.ElementAt(0); | ||
589 | } | ||
590 | return null; | ||
591 | } | ||
592 | |||
573 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) | 593 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) |
574 | { | 594 | { |
575 | gatekeeper = new GridRegion(); | 595 | gatekeeper = new GridRegion(); |