diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e8f18e7eac..51897d7e99 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -285,9 +285,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;
}
@@ -324,8 +325,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))
@@ -797,7 +796,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)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 9363714e3c..41dbffb329 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -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);
}
return false;
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index e8a662910b..e1eee3b128 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -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;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 171d63705c..f38a6fcbf0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5145,9 +5145,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)
{
- string reason;
+ reason = "You are banned from the region";
if (!AuthorizeUser(agentID, out reason))
{
@@ -5178,6 +5178,8 @@ namespace OpenSim.Region.Framework.Scenes
if (banned || restricted)
return false;
}
+
+ reason = String.Empty;
return true;
}
}
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 448e321e03..616aef3390 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -346,10 +346,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)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 46ad9dd81f..98f72f0c9c 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -256,8 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
///
///
- 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)
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index f08e1c0449..5bb24c5e82 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -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);
///
/// Message from receiving region to departing region, telling it got contacted by the client.