diff options
-rw-r--r-- | OpenSim/Services/HypergridService/GatekeeperService.cs | 27 | ||||
-rw-r--r-- | bin/data/LICENSE-README-IMPORTANT.txt | 2 |
2 files changed, 25 insertions, 4 deletions
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 | |||
72 | private static Uri m_Uri; | 72 | private static Uri m_Uri; |
73 | private static GridRegion m_DefaultGatewayRegion; | 73 | private static GridRegion m_DefaultGatewayRegion; |
74 | 74 | ||
75 | private static Random m_Random; | ||
76 | |||
75 | public GatekeeperService(IConfigSource config, ISimulationService simService) | 77 | public GatekeeperService(IConfigSource config, ISimulationService simService) |
76 | { | 78 | { |
77 | if (!m_Initialized) | 79 | if (!m_Initialized) |
78 | { | 80 | { |
79 | m_Initialized = true; | 81 | m_Initialized = true; |
82 | m_Random = new Random(); | ||
80 | 83 | ||
81 | IConfig serverConfig = config.Configs["GatekeeperService"]; | 84 | IConfig serverConfig = config.Configs["GatekeeperService"]; |
82 | if (serverConfig == null) | 85 | if (serverConfig == null) |
@@ -220,6 +223,8 @@ namespace OpenSim.Services.HypergridService | |||
220 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) | 223 | public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) |
221 | { | 224 | { |
222 | reason = string.Empty; | 225 | reason = string.Empty; |
226 | List<GridRegion> defaultRegions; | ||
227 | List<GridRegion> fallbackRegions; | ||
223 | 228 | ||
224 | string authURL = string.Empty; | 229 | string authURL = string.Empty; |
225 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 230 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
@@ -374,8 +379,14 @@ namespace OpenSim.Services.HypergridService | |||
374 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); | 379 | destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); |
375 | if (destination == null) | 380 | if (destination == null) |
376 | { | 381 | { |
377 | reason = "Destination region not found"; | 382 | defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); |
378 | return false; | 383 | if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0)) |
384 | { | ||
385 | reason = "Destination region not found"; | ||
386 | return false; | ||
387 | } | ||
388 | int index = m_Random.Next(0, defaultRegions.Count - 1); | ||
389 | destination = defaultRegions[index]; | ||
379 | } | 390 | } |
380 | 391 | ||
381 | m_log.DebugFormat( | 392 | m_log.DebugFormat( |
@@ -415,7 +426,17 @@ namespace OpenSim.Services.HypergridService | |||
415 | 426 | ||
416 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); | 427 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); |
417 | 428 | ||
418 | return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); | 429 | // try login to the desired region |
430 | if (m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason)) | ||
431 | return true; | ||
432 | |||
433 | // if that failed, try the fallbacks | ||
434 | fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY); | ||
435 | foreach (GridRegion r in fallbackRegions) | ||
436 | if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason)) | ||
437 | return true; | ||
438 | |||
439 | return false; | ||
419 | } | 440 | } |
420 | 441 | ||
421 | protected bool Authenticate(AgentCircuitData aCircuit) | 442 | protected bool Authenticate(AgentCircuitData aCircuit) |
diff --git a/bin/data/LICENSE-README-IMPORTANT.txt b/bin/data/LICENSE-README-IMPORTANT.txt index a1ac20c..dd8671d 100644 --- a/bin/data/LICENSE-README-IMPORTANT.txt +++ b/bin/data/LICENSE-README-IMPORTANT.txt | |||
@@ -2,4 +2,4 @@ Not all of the files in this directory are licensed under the BSD license. Some | |||
2 | 2 | ||
3 | These files are: | 3 | These files are: |
4 | 4 | ||
5 | - avataranimations.xml (Derivative work of viewerart.ini, Creative Commons Attribution+Share-Alike v2.5 License) | 5 | - avataranimations.xml (Derivative work of viewerart.ini, Creative Commons Attribution+Share-Alike v2.5 License) |