diff options
author | Melanie | 2011-02-16 08:06:11 +0000 |
---|---|---|
committer | Melanie | 2011-02-16 08:06:11 +0000 |
commit | 918c12c965e822457807563acd4e16638a6bd3cc (patch) | |
tree | a910e27a3da8e3a1661434224230ad7e987d1070 | |
parent | Catch HttpServer exception: mantis #5381 (diff) | |
download | opensim-SC-918c12c965e822457807563acd4e16638a6bd3cc.zip opensim-SC-918c12c965e822457807563acd4e16638a6bd3cc.tar.gz opensim-SC-918c12c965e822457807563acd4e16638a6bd3cc.tar.bz2 opensim-SC-918c12c965e822457807563acd4e16638a6bd3cc.tar.xz |
Change the QUERYACCESS method to eliminate spurious access denied messages
7 files changed, 40 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1337143..98aa563 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -284,9 +284,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
284 | return; | 284 | return; |
285 | } | 285 | } |
286 | 286 | ||
287 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero)) | 287 | string reason; |
288 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) | ||
288 | { | 289 | { |
289 | sp.ControllingClient.SendTeleportFailed("The destination region has refused access"); | 290 | sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); |
290 | return; | 291 | return; |
291 | } | 292 | } |
292 | 293 | ||
@@ -323,8 +324,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
323 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 324 | agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
324 | } | 325 | } |
325 | 326 | ||
326 | string reason = String.Empty; | ||
327 | |||
328 | // Let's create an agent there if one doesn't exist yet. | 327 | // Let's create an agent there if one doesn't exist yet. |
329 | bool logout = false; | 328 | bool logout = false; |
330 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 329 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
@@ -778,7 +777,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
778 | 777 | ||
779 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 778 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
780 | 779 | ||
781 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos)) | 780 | string reason; |
781 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) | ||
782 | { | 782 | { |
783 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); | 783 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); |
784 | if (r == null) | 784 | if (r == null) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 56720b7..a298b65 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 | |||
257 | return false; | 257 | return false; |
258 | } | 258 | } |
259 | 259 | ||
260 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) | 260 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) |
261 | { | 261 | { |
262 | reason = "Communications failure"; | ||
262 | if (destination == null) | 263 | if (destination == null) |
263 | return false; | 264 | return false; |
264 | 265 | ||
265 | foreach (Scene s in m_sceneList) | 266 | foreach (Scene s in m_sceneList) |
266 | { | 267 | { |
267 | if (s.RegionInfo.RegionID == destination.RegionID) | 268 | if (s.RegionInfo.RegionID == destination.RegionID) |
268 | return s.QueryAccess(id, position); | 269 | return s.QueryAccess(id, position, out reason); |
269 | } | 270 | } |
270 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | 271 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); |
271 | return false; | 272 | return false; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index c4919b3..0c92bd1 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 | |||
239 | 239 | ||
240 | } | 240 | } |
241 | 241 | ||
242 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) | 242 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) |
243 | { | 243 | { |
244 | reason = "Communications failure"; | ||
244 | if (destination == null) | 245 | if (destination == null) |
245 | return false; | 246 | return false; |
246 | 247 | ||
247 | // Try local first | 248 | // Try local first |
248 | if (m_localBackend.QueryAccess(destination, id, position)) | 249 | if (m_localBackend.QueryAccess(destination, id, position, out reason)) |
249 | return true; | 250 | return true; |
250 | 251 | ||
251 | // else do the remote thing | 252 | // else do the remote thing |
252 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 253 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) |
253 | return m_remoteConnector.QueryAccess(destination, id, position); | 254 | return m_remoteConnector.QueryAccess(destination, id, position, out reason); |
254 | 255 | ||
255 | return false; | 256 | return false; |
256 | 257 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 355671c..2fd6b52 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4923,8 +4923,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4923 | // from logging into the region, teleporting into the region | 4923 | // from logging into the region, teleporting into the region |
4924 | // or corssing the broder walking, but will NOT prevent | 4924 | // or corssing the broder walking, but will NOT prevent |
4925 | // child agent creation, thereby emulating the SL behavior. | 4925 | // child agent creation, thereby emulating the SL behavior. |
4926 | public bool QueryAccess(UUID agentID, Vector3 position) | 4926 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
4927 | { | 4927 | { |
4928 | reason = String.Empty; | ||
4928 | return true; | 4929 | return true; |
4929 | } | 4930 | } |
4930 | } | 4931 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 6a23dee..372a59c 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -341,10 +341,17 @@ namespace OpenSim.Server.Handlers.Simulation | |||
341 | GridRegion destination = new GridRegion(); | 341 | GridRegion destination = new GridRegion(); |
342 | destination.RegionID = regionID; | 342 | destination.RegionID = regionID; |
343 | 343 | ||
344 | bool result = m_SimulationService.QueryAccess(destination, id, position); | 344 | string reason; |
345 | bool result = m_SimulationService.QueryAccess(destination, id, position, out reason); | ||
345 | 346 | ||
346 | responsedata["int_response_code"] = HttpStatusCode.OK; | 347 | responsedata["int_response_code"] = HttpStatusCode.OK; |
347 | responsedata["str_response_string"] = result.ToString(); | 348 | |
349 | OSDMap resp = new OSDMap(2); | ||
350 | |||
351 | resp["success"] = OSD.FromBoolean(result); | ||
352 | resp["reason"] = OSD.FromString(reason); | ||
353 | |||
354 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | ||
348 | } | 355 | } |
349 | 356 | ||
350 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) | 357 | 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 cc6bffb..f6ee493 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -256,8 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
256 | 256 | ||
257 | /// <summary> | 257 | /// <summary> |
258 | /// </summary> | 258 | /// </summary> |
259 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) | 259 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) |
260 | { | 260 | { |
261 | reason = "Failed to contact destination"; | ||
262 | |||
261 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); | 263 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); |
262 | 264 | ||
263 | IPEndPoint ext = destination.ExternalEndPoint; | 265 | IPEndPoint ext = destination.ExternalEndPoint; |
@@ -283,8 +285,21 @@ namespace OpenSim.Services.Connectors.Simulation | |||
283 | 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"); | 285 | 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"); |
284 | return true; | 286 | return true; |
285 | } | 287 | } |
288 | |||
289 | reason = result["Message"]; | ||
290 | } | ||
291 | else | ||
292 | { | ||
293 | reason = "Communications failure"; | ||
286 | } | 294 | } |
295 | |||
296 | return false; | ||
287 | } | 297 | } |
298 | |||
299 | OSDMap resp = (OSDMap)result["_Result"]; | ||
300 | success = resp["success"].AsBoolean(); | ||
301 | reason = resp["reason"].AsString(); | ||
302 | |||
288 | return success; | 303 | return success; |
289 | } | 304 | } |
290 | catch (Exception e) | 305 | catch (Exception e) |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 48a2185..b796757 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces | |||
60 | 60 | ||
61 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); | 61 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); |
62 | 62 | ||
63 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position); | 63 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason); |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// Message from receiving region to departing region, telling it got contacted by the client. | 66 | /// Message from receiving region to departing region, telling it got contacted by the client. |