aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs27
1 files changed, 3 insertions, 24 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 4a6b079..e10c4cb 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -72,14 +72,11 @@ 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
77 public GatekeeperService(IConfigSource config, ISimulationService simService) 75 public GatekeeperService(IConfigSource config, ISimulationService simService)
78 { 76 {
79 if (!m_Initialized) 77 if (!m_Initialized)
80 { 78 {
81 m_Initialized = true; 79 m_Initialized = true;
82 m_Random = new Random();
83 80
84 IConfig serverConfig = config.Configs["GatekeeperService"]; 81 IConfig serverConfig = config.Configs["GatekeeperService"];
85 if (serverConfig == null) 82 if (serverConfig == null)
@@ -223,8 +220,6 @@ namespace OpenSim.Services.HypergridService
223 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) 220 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason)
224 { 221 {
225 reason = string.Empty; 222 reason = string.Empty;
226 List<GridRegion> defaultRegions;
227 List<GridRegion> fallbackRegions;
228 223
229 string authURL = string.Empty; 224 string authURL = string.Empty;
230 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 225 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
@@ -379,14 +374,8 @@ namespace OpenSim.Services.HypergridService
379 destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); 374 destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID);
380 if (destination == null) 375 if (destination == null)
381 { 376 {
382 defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); 377 reason = "Destination region not found";
383 if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0)) 378 return false;
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];
390 } 379 }
391 380
392 m_log.DebugFormat( 381 m_log.DebugFormat(
@@ -426,17 +415,7 @@ namespace OpenSim.Services.HypergridService
426 415
427 m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); 416 m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag);
428 417
429 // try login to the desired region 418 return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason);
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;
440 } 419 }
441 420
442 protected bool Authenticate(AgentCircuitData aCircuit) 421 protected bool Authenticate(AgentCircuitData aCircuit)