aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2013-08-24 03:41:56 -0700
committerDiva Canto2013-08-24 03:41:56 -0700
commitc7a8afbb8da40e09252d58d95c89b8a99a684157 (patch)
tree0afe6844eb0508957ac496cb1ea75efc418cad6f /OpenSim
parentWhitespace fubar. (diff)
downloadopensim-SC_OLD-c7a8afbb8da40e09252d58d95c89b8a99a684157.zip
opensim-SC_OLD-c7a8afbb8da40e09252d58d95c89b8a99a684157.tar.gz
opensim-SC_OLD-c7a8afbb8da40e09252d58d95c89b8a99a684157.tar.bz2
opensim-SC_OLD-c7a8afbb8da40e09252d58d95c89b8a99a684157.tar.xz
Make HG logins fall back to fallback regions if the desired region fails.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs27
1 files changed, 24 insertions, 3 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)