Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

varregion
Justin Clark-Casey (justincc) 2013-08-25 20:12:59 +01:00
commit 85824d2cd9
4 changed files with 30 additions and 6 deletions

View File

@ -536,7 +536,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message); m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e);
return null; return null;
} }
} }

View File

@ -3824,7 +3824,7 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
if (!AuthorizeUser(acd, SeeIntoRegion, out reason)) if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason))
{ {
m_authenticateHandler.RemoveCircuit(acd.circuitcode); m_authenticateHandler.RemoveCircuit(acd.circuitcode);
return false; return false;

View File

@ -72,11 +72,14 @@ namespace OpenSim.Services.HypergridService
private static Uri m_Uri; private static Uri m_Uri;
private static GridRegion m_DefaultGatewayRegion; private static GridRegion m_DefaultGatewayRegion;
private static Random m_Random;
public GatekeeperService(IConfigSource config, ISimulationService simService) public GatekeeperService(IConfigSource config, ISimulationService simService)
{ {
if (!m_Initialized) if (!m_Initialized)
{ {
m_Initialized = true; m_Initialized = true;
m_Random = new Random();
IConfig serverConfig = config.Configs["GatekeeperService"]; IConfig serverConfig = config.Configs["GatekeeperService"];
if (serverConfig == null) if (serverConfig == null)
@ -220,6 +223,8 @@ namespace OpenSim.Services.HypergridService
public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
List<GridRegion> defaultRegions;
List<GridRegion> fallbackRegions;
string authURL = string.Empty; string authURL = string.Empty;
if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
@ -373,10 +378,16 @@ namespace OpenSim.Services.HypergridService
// //
destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID);
if (destination == null) if (destination == null)
{
defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero);
if (defaultRegions == null || (defaultRegions != null && defaultRegions.Count == 0))
{ {
reason = "Destination region not found"; reason = "Destination region not found";
return false; return false;
} }
int index = m_Random.Next(0, defaultRegions.Count - 1);
destination = defaultRegions[index];
}
m_log.DebugFormat( m_log.DebugFormat(
"[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name); "[GATEKEEPER SERVICE]: Destination {0} is ok for {1}", destination.RegionName, aCircuit.Name);
@ -415,7 +426,20 @@ namespace OpenSim.Services.HypergridService
m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag); m_log.DebugFormat("[GATEKEEPER SERVICE]: Launching {0} {1}", aCircuit.Name, loginFlag);
return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); // try login to the desired region
if (m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason))
return true;
// if that failed, try the fallbacks
m_log.DebugFormat("[GATEKEEPER SERVICE]: Region {0} did not accept agent {1}", destination.RegionName, aCircuit.Name);
fallbackRegions = m_GridService.GetFallbackRegions(UUID.Zero, destination.RegionLocX, destination.RegionLocY);
foreach (GridRegion r in fallbackRegions)
{
m_log.DebugFormat("[GATEKEEPER SERVICE]: Trying region {0}...", r.RegionName);
if (m_SimulationService.CreateAgent(r, aCircuit, (uint)loginFlag, out reason))
return true;
}
return false;
} }
protected bool Authenticate(AgentCircuitData aCircuit) protected bool Authenticate(AgentCircuitData aCircuit)