* Deal with a WebException thrown if a grid server cannot be contacted for region information

0.6.0-stable
Justin Clarke Casey 2008-08-25 21:26:58 +00:00
parent 24456e846c
commit 7402c2d288
3 changed files with 26 additions and 7 deletions

View File

@ -1355,7 +1355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
/// <summary> /// <summary>
/// /// Inform the client that a teleport attempt has failed
/// </summary> /// </summary>
public void SendTeleportFailed(string reason) public void SendTeleportFailed(string reason)
{ {

View File

@ -282,10 +282,14 @@ namespace OpenSim.Region.Communications.OGS1
} }
/// <summary> /// <summary>
/// /// Request information about a region.
/// </summary> /// </summary>
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <returns></returns> /// <returns>
/// 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.
/// </returns>
public RegionInfo RequestNeighbourInfo(LLUUID Region_UUID) public RegionInfo RequestNeighbourInfo(LLUUID Region_UUID)
{ {
RegionInfo regionInfo; RegionInfo regionInfo;
@ -294,10 +298,23 @@ namespace OpenSim.Region.Communications.OGS1
requestData["authkey"] = serversInfo.GridSendKey; requestData["authkey"] = serversInfo.GridSendKey;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(requestData); SendParams.Add(requestData);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); XmlRpcResponse gridResp = null;
Hashtable responseData = (Hashtable) GridResp.Value; 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;
if (responseData.ContainsKey("error")) if (responseData.ContainsKey("error"))
{ {
@ -335,7 +352,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
/// <summary> /// <summary>
/// /// Request information about a region.
/// </summary> /// </summary>
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <returns></returns> /// <returns></returns>

View File

@ -2897,12 +2897,14 @@ namespace OpenSim.Region.Environment.Scenes
public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position) public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position)
{ {
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID); RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID);
if (info == null) if (info == null)
{ {
// can't find the region: Tell viewer and abort // can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The teleport destination could not be found."); remoteClient.SendTeleportFailed("The teleport destination could not be found.");
return; return;
} }
lock (m_scenePresences) lock (m_scenePresences)
{ {
if (m_scenePresences.ContainsKey(remoteClient.AgentId)) if (m_scenePresences.ContainsKey(remoteClient.AgentId))