Change the QUERYACCESS method to eliminate spurious access denied messages

0.7.1-dev
Melanie 2011-02-16 08:06:11 +00:00
parent 5d6d0aa142
commit 918c12c965
7 changed files with 40 additions and 15 deletions

View File

@ -284,9 +284,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero))
string reason;
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason))
{
sp.ControllingClient.SendTeleportFailed("The destination region has refused access");
sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
return;
}
@ -323,8 +324,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
}
string reason = String.Empty;
// Let's create an agent there if one doesn't exist yet.
bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
@ -778,7 +777,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos))
string reason;
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason))
{
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
if (r == null)

View File

@ -257,15 +257,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
{
reason = "Communications failure";
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionID == destination.RegionID)
return s.QueryAccess(id, position);
return s.QueryAccess(id, position, out reason);
}
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
return false;

View File

@ -239,18 +239,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
}
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
{
reason = "Communications failure";
if (destination == null)
return false;
// Try local first
if (m_localBackend.QueryAccess(destination, id, position))
if (m_localBackend.QueryAccess(destination, id, position, out reason))
return true;
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.QueryAccess(destination, id, position);
return m_remoteConnector.QueryAccess(destination, id, position, out reason);
return false;

View File

@ -4923,8 +4923,9 @@ namespace OpenSim.Region.Framework.Scenes
// from logging into the region, teleporting into the region
// or corssing the broder walking, but will NOT prevent
// child agent creation, thereby emulating the SL behavior.
public bool QueryAccess(UUID agentID, Vector3 position)
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
{
reason = String.Empty;
return true;
}
}

View File

@ -341,10 +341,17 @@ namespace OpenSim.Server.Handlers.Simulation
GridRegion destination = new GridRegion();
destination.RegionID = regionID;
bool result = m_SimulationService.QueryAccess(destination, id, position);
string reason;
bool result = m_SimulationService.QueryAccess(destination, id, position, out reason);
responsedata["int_response_code"] = HttpStatusCode.OK;
responsedata["str_response_string"] = result.ToString();
OSDMap resp = new OSDMap(2);
resp["success"] = OSD.FromBoolean(result);
resp["reason"] = OSD.FromString(reason);
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
}
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)

View File

@ -256,8 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
/// <summary>
/// </summary>
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
{
reason = "Failed to contact destination";
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
IPEndPoint ext = destination.ExternalEndPoint;
@ -283,8 +285,21 @@ namespace OpenSim.Services.Connectors.Simulation
m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
return true;
}
reason = result["Message"];
}
else
{
reason = "Communications failure";
}
return false;
}
OSDMap resp = (OSDMap)result["_Result"];
success = resp["success"].AsBoolean();
reason = resp["reason"].AsString();
return success;
}
catch (Exception e)

View File

@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
bool QueryAccess(GridRegion destination, UUID id, Vector3 position);
bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason);
/// <summary>
/// Message from receiving region to departing region, telling it got contacted by the client.