From 7402c2d288045fc817c2da8ae6b336253a57b290 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 25 Aug 2008 21:26:58 +0000 Subject: * Deal with a WebException thrown if a grid server cannot be contacted for region information --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 29 +++++++++++++++++----- OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8214045..a30cafd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1355,7 +1355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// + /// Inform the client that a teleport attempt has failed /// public void SendTeleportFailed(string reason) { diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 7baaa16..4346ecb 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -282,10 +282,14 @@ namespace OpenSim.Region.Communications.OGS1 } /// - /// + /// Request information about a region. /// /// - /// + /// + /// null on a failure to contact or get a response from the grid server + /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the + /// nature of the faiulre. + /// public RegionInfo RequestNeighbourInfo(LLUUID Region_UUID) { RegionInfo regionInfo; @@ -294,10 +298,23 @@ namespace OpenSim.Region.Communications.OGS1 requestData["authkey"] = serversInfo.GridSendKey; ArrayList SendParams = new ArrayList(); SendParams.Add(requestData); - XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); + XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams); + XmlRpcResponse gridResp = null; + + try + { + gridResp = gridReq.Send(serversInfo.GridURL, 3000); + } + catch (WebException e) + { + m_log.ErrorFormat( + "[OGS1 GRID SERVICES]: Communication with the grid server at {0} failed, {1}", + serversInfo.GridURL, e); + + return null; + } - Hashtable responseData = (Hashtable) GridResp.Value; + Hashtable responseData = (Hashtable)gridResp.Value; if (responseData.ContainsKey("error")) { @@ -335,7 +352,7 @@ namespace OpenSim.Region.Communications.OGS1 } /// - /// + /// Request information about a region. /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 6f3267a..9b91176 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2897,12 +2897,14 @@ namespace OpenSim.Region.Environment.Scenes public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position) { RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID); + if (info == null) { // can't find the region: Tell viewer and abort remoteClient.SendTeleportFailed("The teleport destination could not be found."); return; } + lock (m_scenePresences) { if (m_scenePresences.ContainsKey(remoteClient.AgentId)) -- cgit v1.1